Guest User

Untitled

a guest
Jan 18th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.51 KB | None | 0 0
  1. {
  2. "AWSTemplateFormatVersion": "2010-09-09",
  3. "Parameters": {
  4. "DevServerKeyPair": {
  5. "Description": "Name of an existing EC2 KeyPair to enable SSH access to the instance",
  6. "Type": "AWS::EC2::KeyPair::KeyName",
  7. "ConstraintDescription": "Must be the name of an existing EC2 KeyPair."
  8. }
  9. },
  10. "Resources": {
  11. "DevVpc": {
  12. "Type": "AWS::EC2::VPC",
  13. "Properties": {
  14. "CidrBlock": "172.31.0.0/16",
  15. "EnableDnsSupport": "false",
  16. "EnableDnsHostnames": "false",
  17. "InstanceTenancy": "dedicated",
  18. "Tags": [
  19. {
  20. "Key": "Name",
  21. "Value": "DevStackVpc"
  22. }
  23. ]
  24. }
  25. },
  26. "DevSubnet": {
  27. "Type": "AWS::EC2::Subnet",
  28. "Properties": {
  29. "VpcId": {
  30. "Ref": "DevVpc"
  31. },
  32. "CidrBlock": "172.31.0.0/16",
  33. "AvailabilityZone": {
  34. "Fn::Select": [
  35. 0,
  36. {
  37. "Fn::GetAZs": ""
  38. }
  39. ]
  40. }
  41. }
  42. },
  43. "WebApplicationServerSG": {
  44. "Type": "AWS::EC2::SecurityGroup",
  45. "Properties": {
  46. "VpcId": {
  47. "Ref": "DevVpc"
  48. },
  49. "GroupDescription": "Enable HTTP, HTTPS and SSH access",
  50. "Tags": [
  51. {
  52. "Key": "Name",
  53. "Value": "WebApplicationServer Service Group"
  54. }
  55. ],
  56. "SecurityGroupIngress": [
  57. {
  58. "IpProtocol": "tcp",
  59. "FromPort": "443",
  60. "ToPort": "443",
  61. "CidrIp": "0.0.0.0/0"
  62. },
  63. {
  64. "IpProtocol": "tcp",
  65. "FromPort": "80",
  66. "ToPort": "80",
  67. "CidrIp": "0.0.0.0/0"
  68. },
  69. {
  70. "IpProtocol": "tcp",
  71. "FromPort": "22",
  72. "ToPort": "22",
  73. "CidrIp": "0.0.0.0/0"
  74. }
  75. ],
  76. "SecurityGroupEgress": [
  77. {
  78. "IpProtocol": "tcp",
  79. "FromPort": "443",
  80. "ToPort": "443",
  81. "CidrIp": "0.0.0.0/0"
  82. },
  83. {
  84. "IpProtocol": "tcp",
  85. "FromPort": "80",
  86. "ToPort": "80",
  87. "CidrIp": "0.0.0.0/0"
  88. },
  89. {
  90. "IpProtocol": "tcp",
  91. "FromPort": "22",
  92. "ToPort": "22",
  93. "CidrIp": "0.0.0.0/0"
  94. }
  95. ]
  96. }
  97. },
  98. "WebApplicationServer": {
  99. "Type": "AWS::EC2::Instance",
  100. "Properties": {
  101. "ImageId": "ami-f3e5aa9c",
  102. "InstanceType": "t2.micro",
  103. "Tags": [
  104. {
  105. "Key": "Name",
  106. "Value": "WebApplicationServer"
  107. }
  108. ],
  109. "KeyName": {
  110. "Ref": "DevServerKeyPair"
  111. },
  112. "NetworkInterfaces": [
  113. {
  114. "SubnetId": {"Ref": "DevSubnet"},
  115. "AssociatePublicIpAddress": "true",
  116. "DeviceIndex": "0",
  117. "GroupSet": [{ "Ref" : "WebApplicationServerSG" }]
  118. }
  119. ]
  120. }
  121. }
  122. }
  123. }
Add Comment
Please, Sign In to add comment