Guest User

Untitled

a guest
Jul 21st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. AWSTemplateFormatVersion: "2010-09-09"
  2. Mappings:
  3. RegionMap:
  4. us-east-1:
  5. AMI: "ami-a4c7edb2"
  6. TestAz: "us-east-1a"
  7. us-west-1:
  8. AMI: "ami-6df1e514"
  9. TestAz: "us-west-1a"
  10. us-west-2:
  11. AMI: "ami-327f5352"
  12. TestAz: "us-west-2a"
  13. eu-west-1:
  14. AMI: "ami-d7b9a2b1"
  15. TestAz: "eu-west-1a"
  16. sa-east-1:
  17. AMI: "ami-87dab1eb"
  18. TestAz: "sa-east-1a"
  19. ap-southeast-1:
  20. AMI: "ami-77af2014"
  21. TestAz: "ap-southeast-1a"
  22. ap-southeast-2:
  23. AMI: "ami-10918173"
  24. TestAz: "ap-southeast-2a"
  25. ap-northeast-1:
  26. AMI: "ami-e21cc38c"
  27. TestAz: "ap-northeast-1a"
  28. Parameters:
  29. EnvType:
  30. Description: Environment type.
  31. Default: test
  32. Type: String
  33. AllowedValues:
  34. - prod
  35. - test
  36. ConstraintDescription: must specify prod or test.
  37.  
  38. Conditions:
  39. CreateProdResources: !Equals [ !Ref EnvType, prod ]
  40.  
  41. Resources:
  42. EC2Instance:
  43. Type: "AWS::EC2::Instance"
  44. Properties:
  45. ImageId: !FindInMap [RegionMap, !Ref "AWS::Region", AMI]
  46. InstanceType: t2.micro
  47. AvailabilityZone: !FindInMap [RegionMap, !Ref "AWS::Region", TestAz]
  48.  
  49. MountPoint:
  50. Type: "AWS::EC2::VolumeAttachment"
  51. Condition: CreateProdResources
  52. Properties:
  53. InstanceId:
  54. !Ref EC2Instance
  55. VolumeId:
  56. !Ref NewVolume
  57. Device: /dev/sdh
  58.  
  59. NewVolume:
  60. Type: "AWS::EC2::Volume"
  61. Condition: CreateProdResources
  62. Properties:
  63. Size: 100
  64. AvailabilityZone:
  65. !GetAtt EC2Instance.AvailabilityZone
  66.  
  67. Outputs:
  68. VolumeId:
  69. Condition: CreateProdResources
  70. Value:
  71. !Ref NewVolume
Add Comment
Please, Sign In to add comment