Advertisement
uopspop

Untitled

Sep 12th, 2019
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.98 KB | None | 0 0
  1. {
  2. "AWSTemplateFormatVersion" : "2010-09-09",
  3. "Description" : "AWS CloudFormation Sample Template VPC_with_PublicIPs_And_DNS: Sample template that creates a VPC with DNS and public IPs enabled. Note that you are billed for the AWS resources that you use when you create a stack from this template.",
  4. "Resources" : {
  5. "VPC" : {
  6. "Type" : "AWS::EC2::VPC",
  7. "Properties" : {
  8. "EnableDnsSupport" : "true",
  9. "EnableDnsHostnames" : "true",
  10. "CidrBlock" : "10.0.0.0/16"
  11. }
  12. },
  13. "PublicSubnet" : {
  14. "Type" : "AWS::EC2::Subnet",
  15. "Properties" : {
  16. "VpcId" : { "Ref" : "VPC" },
  17. "CidrBlock" : "10.0.0.0/24"
  18. }
  19. },
  20. "InternetGateway" : {
  21. "Type" : "AWS::EC2::InternetGateway"
  22. },
  23. "VPCGatewayAttachment" : {
  24. "Type" : "AWS::EC2::VPCGatewayAttachment",
  25. "Properties" : {
  26. "VpcId" : { "Ref" : "VPC" },
  27. "InternetGatewayId" : { "Ref" : "InternetGateway" }
  28. }
  29. },
  30. "PublicRouteTable" : {
  31. "Type" : "AWS::EC2::RouteTable",
  32. "Properties" : {
  33. "VpcId" : { "Ref" : "VPC" }
  34. }
  35. },
  36. "PublicRoute" : {
  37. "Type" : "AWS::EC2::Route",
  38. "DependsOn" : "VPCGatewayAttachment",
  39. "Properties" : {
  40. "RouteTableId" : { "Ref" : "PublicRouteTable" },
  41. "DestinationCidrBlock" : "0.0.0.0/0",
  42. "GatewayId" : { "Ref" : "InternetGateway" }
  43. }
  44. },
  45. "PublicSubnetRouteTableAssociation" : {
  46. "Type" : "AWS::EC2::SubnetRouteTableAssociation",
  47. "Properties" : {
  48. "SubnetId" : { "Ref" : "PublicSubnet" },
  49. "RouteTableId" : { "Ref" : "PublicRouteTable" }
  50. }
  51. },
  52. "PublicSubnetNetworkAclAssociation" : {
  53. "Type" : "AWS::EC2::SubnetNetworkAclAssociation",
  54. "Properties" : {
  55. "SubnetId" : { "Ref" : "PublicSubnet" },
  56. "NetworkAclId" : { "Fn::GetAtt" : ["VPC", "DefaultNetworkAcl"] }
  57. }
  58. },
  59. "WebServerSecurityGroup" : {
  60. "Type" : "AWS::EC2::SecurityGroup",
  61. "Properties" : {
  62. "GroupDescription" : "Enable HTTP ingress",
  63. "VpcId" : { "Ref" : "VPC" },
  64. "SecurityGroupIngress" : [ {
  65. "IpProtocol" : "tcp",
  66. "FromPort" : "80",
  67. "ToPort" : "80",
  68. "CidrIp" : "0.0.0.0/0"
  69. } ]
  70. }
  71. }
  72. },
  73. "Outputs" : {
  74. "VPCId" : {
  75. "Description" : "VPC ID",
  76. "Value" : { "Ref" : "VPC" },
  77. "Export" : { "Name" : {"Fn::Sub": "${AWS::StackName}-VPCID" }}
  78. },
  79. "PublicSubnet" : {
  80. "Description" : "The subnet ID to use for public web servers",
  81. "Value" : { "Ref" : "PublicSubnet" },
  82. "Export" : { "Name" : {"Fn::Sub": "${AWS::StackName}-SubnetID" }}
  83. },
  84. "WebServerSecurityGroup" : {
  85. "Description" : "The security group ID to use for public web servers",
  86. "Value" : { "Fn::GetAtt" : ["WebServerSecurityGroup", "GroupId"] },
  87. "Export" : { "Name" : {"Fn::Sub": "${AWS::StackName}-SecurityGroupID" }}
  88. }
  89. }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement