Advertisement
uopspop

Untitled

Nov 15th, 2018
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 13.45 KB | None | 0 0
  1. AWSTemplateFormatVersion: 2010-09-09
  2. Parameters:
  3.   KeyPairName:
  4.     Description:
  5.      You must have your public key on your aws - ec2 - network & security - key
  6.       pairs section
  7.     Type: String
  8.   OverallTagName:
  9.     Type: String
  10.     Default: st-formation
  11.     Description: The tag name for all resources created under this template
  12.   ASG001DesiredCapacity:
  13.     Type: String
  14.     Default: 1
  15.     Description: AutoScalingGroup Initial Desired Capacity
  16. Resources:
  17.   VPC001:
  18.     Type: 'AWS::EC2::VPC'
  19.     Properties:
  20.       CidrBlock: 10.99.0.0/16
  21.       InstanceTenancy: default
  22.       EnableDnsSupport: 'true'
  23.       EnableDnsHostnames: 'false'
  24.       Tags:
  25.         - Key: Name
  26.           Value: !Ref OverallTagName
  27.     Metadata:
  28.       'AWS::CloudFormation::Designer':
  29.         id: 100906b8-589d-45d3-9633-4eb9e44ddbaf
  30.   Subnet001:
  31.     Type: 'AWS::EC2::Subnet'
  32.     Properties:
  33.       CidrBlock: 10.99.0.0/24
  34.       AvailabilityZone: us-west-2b
  35.       VpcId: !Ref VPC001
  36.       Tags:
  37.         - Key: Name
  38.           Value: !Ref OverallTagName
  39.     Metadata:
  40.       'AWS::CloudFormation::Designer':
  41.         id: 80af6f4c-1d4d-4f66-8237-11fbaa5d8061
  42.   IGW001:
  43.     Type: 'AWS::EC2::InternetGateway'
  44.     Properties:
  45.       Tags:
  46.         - Key: Name
  47.           Value: !Ref OverallTagName
  48.     Metadata:
  49.       'AWS::CloudFormation::Designer':
  50.         id: 6c215780-cc5d-4f7c-9029-f833506b0ab6
  51.   NACL001:
  52.     Type: 'AWS::EC2::NetworkAcl'
  53.     Properties:
  54.       VpcId: !Ref VPC001
  55.       Tags:
  56.         - Key: Name
  57.           Value: !Ref OverallTagName
  58.     Metadata:
  59.       'AWS::CloudFormation::Designer':
  60.         id: cda52d9d-e7bd-468e-91d9-d51ffa33abd1
  61.   RouteTable001:
  62.     Type: 'AWS::EC2::RouteTable'
  63.     Properties:
  64.       VpcId: !Ref VPC001
  65.       Tags:
  66.         - Key: Name
  67.           Value: !Ref OverallTagName
  68.     Metadata:
  69.       'AWS::CloudFormation::Designer':
  70.         id: c93e3089-9729-4403-b730-6737ff99ad2a
  71.   SG001:
  72.     Type: 'AWS::EC2::SecurityGroup'
  73.     Properties:
  74.       GroupDescription: 'launch-wizard-37 created 2018-04-17T19:55:21.240+08:00'
  75.       VpcId: !Ref VPC001
  76.       Tags:
  77.         - Key: Name
  78.           Value: !Ref OverallTagName
  79.     Metadata:
  80.       'AWS::CloudFormation::Designer':
  81.         id: c8ac8be7-0b4a-4496-a8d3-1a54e2e42d5a
  82.   NaclEgressRule001:
  83.     Type: 'AWS::EC2::NetworkAclEntry'
  84.     Properties:
  85.       CidrBlock: 0.0.0.0/0
  86.       Egress: 'true'
  87.       Protocol: '-1'
  88.       RuleAction: allow
  89.       RuleNumber: '100'
  90.       NetworkAclId: !Ref NACL001
  91.     Metadata:
  92.       'AWS::CloudFormation::Designer':
  93.         id: 811c3c9c-8e1d-413a-b908-22829b94aa85
  94.   NaclIngressRule001:
  95.     Type: 'AWS::EC2::NetworkAclEntry'
  96.     Properties:
  97.       CidrBlock: 0.0.0.0/0
  98.       Protocol: '-1'
  99.       RuleAction: allow
  100.       RuleNumber: '101'
  101.       NetworkAclId: !Ref NACL001
  102.     Metadata:
  103.       'AWS::CloudFormation::Designer':
  104.         id: 1b8e9c00-552b-421b-bbd6-3d8773821d7e
  105.   SubnetNaclAssoc001:
  106.     Type: 'AWS::EC2::SubnetNetworkAclAssociation'
  107.     Properties:
  108.       NetworkAclId: !Ref NACL001
  109.       SubnetId: !Ref Subnet001
  110.     Metadata:
  111.       'AWS::CloudFormation::Designer':
  112.         id: 455b97eb-821c-4699-a909-5fd0b44cabbd
  113.   RouteRuleToTheInternet:
  114.     Type: 'AWS::EC2::Route'
  115.     Properties:
  116.       DestinationCidrBlock: 0.0.0.0/0
  117.       RouteTableId: !Ref RouteTable001
  118.       GatewayId: !Ref IGW001
  119.     Metadata:
  120.       'AWS::CloudFormation::Designer':
  121.         id: 0b13684f-bf67-44c6-a0ce-d788f1544e49
  122.   SubnetRouteTableAssoc001:
  123.     Type: 'AWS::EC2::SubnetRouteTableAssociation'
  124.     Properties:
  125.       RouteTableId: !Ref RouteTable001
  126.       SubnetId: !Ref Subnet001
  127.     Metadata:
  128.       'AWS::CloudFormation::Designer':
  129.         id: 8db514ed-7e5f-42db-868e-e430d15b5bb8
  130.   SGIngressRuleSSH:
  131.     Type: 'AWS::EC2::SecurityGroupIngress'
  132.     Properties:
  133.       GroupId: !Ref SG001
  134.       IpProtocol: tcp
  135.       FromPort: '22'
  136.       ToPort: '22'
  137.       CidrIp: 0.0.0.0/0
  138.   SGIngressRuleHTTP:
  139.     Type: 'AWS::EC2::SecurityGroupIngress'
  140.     Properties:
  141.       GroupId: !Ref SG001
  142.       IpProtocol: tcp
  143.       FromPort: '8080'
  144.       ToPort: '8080'
  145.       CidrIp: 0.0.0.0/0
  146.   SGEgressRuleALL:
  147.     Type: 'AWS::EC2::SecurityGroupEgress'
  148.     Properties:
  149.       GroupId: !Ref SG001
  150.       IpProtocol: '-1'
  151.       CidrIp: 0.0.0.0/0
  152.   DHCP001:
  153.     Type: 'AWS::EC2::DHCPOptions'
  154.     Properties:
  155.       DomainName: us-west-2.compute.internal
  156.       DomainNameServers:
  157.        - AmazonProvidedDNS
  158.     Metadata:
  159.       'AWS::CloudFormation::Designer':
  160.         id: 1f2155f4-d323-494e-b157-1e0a8c2f338c
  161.   VpcDhcpAssoc001:
  162.     Type: 'AWS::EC2::VPCDHCPOptionsAssociation'
  163.     Properties:
  164.       DhcpOptionsId: !Ref DHCP001
  165.       VpcId: !Ref VPC001
  166.     Metadata:
  167.       'AWS::CloudFormation::Designer':
  168.         id: 4e13c20d-0335-44e7-a6f4-d8a27ee8642c
  169.   IgwVpcAssoc001:
  170.     Type: 'AWS::EC2::VPCGatewayAttachment'
  171.     Properties:
  172.       VpcId: !Ref VPC001
  173.       InternetGatewayId: !Ref IGW001
  174.     Metadata:
  175.       'AWS::CloudFormation::Designer':
  176.         id: 16e7a5e4-f13b-4591-b6c8-3722c22f229f
  177.   LaunchConfig001:
  178.     Type: 'AWS::AutoScaling::LaunchConfiguration'
  179.     Properties:
  180.       KeyName: !Ref KeyPairName
  181.       ImageId: ami-223f945a
  182.       InstanceType: t2.micro
  183.       UserData:
  184.         Fn::Base64:                               # YAML makes userdata much cleaner
  185.           !Sub |
  186.              #!/bin/bash -ex
  187.               # install basic modules
  188.               sudo yum update -y;
  189.               sudo yum install ruby -y;
  190.               sudo yum install wget -y;
  191.               # install codedelpoy agent
  192.               sudo wget https://aws-codedeploy-us-east-2.s3.amazonaws.com/latest/install;
  193.               sudo chmod +x ./install;
  194.               sudo ./install auto;
  195.               sudo service codedeploy-agent status;
  196.               # install cfn-bootstrap for rhel7
  197.               sudo yum install python-setuptools -y;
  198.               sudo mkdir -p /opt/aws/bin;
  199.               sudo wget https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz;
  200.               sudo easy_install --script-dir /opt/aws/bin aws-cfn-bootstrap-latest.tar.gz;
  201.               # send complete signal to ASG001
  202.               sudo /opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource ASG001 --region ${AWS::Region}
  203.       AssociatePublicIpAddress: true
  204.       SecurityGroups:
  205.        - !Ref SG001
  206.   ASG001:
  207.     Type: 'AWS::AutoScaling::AutoScalingGroup'
  208.     Properties:
  209.       VPCZoneIdentifier:
  210.        - !Ref Subnet001
  211.       LaunchConfigurationName: !Ref LaunchConfig001
  212.       DesiredCapacity: !Ref ASG001DesiredCapacity
  213.       MinSize: '1'
  214.       MaxSize: '4'
  215.       Tags:
  216.         - PropagateAtLaunch: true
  217.           Key: Name
  218.           Value: !Ref OverallTagName
  219.     CreationPolicy:
  220.       ResourceSignal:
  221.         Count: !Ref ASG001DesiredCapacity
  222.         Timeout: PT30M          
  223. Description: some description for the template
  224. Metadata:
  225.   'AWS::CloudFormation::Designer':
  226.     6c215780-cc5d-4f7c-9029-f833506b0ab6:
  227.       size:
  228.         width: 60
  229.         height: 60
  230.       position:
  231.         x: -130
  232.         'y': 240
  233.       z: 0
  234.       embeds: []
  235.     100906b8-589d-45d3-9633-4eb9e44ddbaf:
  236.       size:
  237.         width: 690
  238.         height: 690
  239.       position:
  240.         x: -10
  241.         'y': 80
  242.       z: 1
  243.       embeds:
  244.        - c93e3089-9729-4403-b730-6737ff99ad2a
  245.         - 80af6f4c-1d4d-4f66-8237-11fbaa5d8061
  246.         - cda52d9d-e7bd-468e-91d9-d51ffa33abd1
  247.     c8ac8be7-0b4a-4496-a8d3-1a54e2e42d5a:
  248.       size:
  249.         width: 60
  250.         height: 60
  251.       position:
  252.         x: -130
  253.         'y': 540
  254.       z: 0
  255.       embeds: []
  256.       iscontainedinside:
  257.        - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  258.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  259.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  260.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  261.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  262.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  263.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  264.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  265.     c93e3089-9729-4403-b730-6737ff99ad2a:
  266.       size:
  267.         width: 240
  268.         height: 240
  269.       position:
  270.         x: 400
  271.         'y': 160
  272.       z: 2
  273.       parent: 100906b8-589d-45d3-9633-4eb9e44ddbaf
  274.       embeds:
  275.        - 0b13684f-bf67-44c6-a0ce-d788f1544e49
  276.       iscontainedinside:
  277.        - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  278.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  279.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  280.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  281.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  282.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  283.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  284.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  285.     0b13684f-bf67-44c6-a0ce-d788f1544e49:
  286.       size:
  287.         width: 60
  288.         height: 60
  289.       position:
  290.         x: 520
  291.         'y': 170
  292.       z: 3
  293.       parent: c93e3089-9729-4403-b730-6737ff99ad2a
  294.       embeds: []
  295.       isassociatedwith:
  296.        - 6c215780-cc5d-4f7c-9029-f833506b0ab6
  297.       iscontainedinside:
  298.        - c93e3089-9729-4403-b730-6737ff99ad2a
  299.         - c93e3089-9729-4403-b730-6737ff99ad2a
  300.         - c93e3089-9729-4403-b730-6737ff99ad2a
  301.         - c93e3089-9729-4403-b730-6737ff99ad2a
  302.         - c93e3089-9729-4403-b730-6737ff99ad2a
  303.         - c93e3089-9729-4403-b730-6737ff99ad2a
  304.         - c93e3089-9729-4403-b730-6737ff99ad2a
  305.         - c93e3089-9729-4403-b730-6737ff99ad2a
  306.     cda52d9d-e7bd-468e-91d9-d51ffa33abd1:
  307.       size:
  308.         width: 330
  309.         height: 240
  310.       position:
  311.         x: 40
  312.         'y': 150
  313.       z: 2
  314.       parent: 100906b8-589d-45d3-9633-4eb9e44ddbaf
  315.       embeds:
  316.        - 1b8e9c00-552b-421b-bbd6-3d8773821d7e
  317.         - 811c3c9c-8e1d-413a-b908-22829b94aa85
  318.       iscontainedinside:
  319.        - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  320.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  321.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  322.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  323.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  324.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  325.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  326.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  327.     1b8e9c00-552b-421b-bbd6-3d8773821d7e:
  328.       size:
  329.         width: 60
  330.         height: 60
  331.       position:
  332.         x: 70
  333.         'y': 210
  334.       z: 3
  335.       parent: cda52d9d-e7bd-468e-91d9-d51ffa33abd1
  336.       embeds: []
  337.       iscontainedinside:
  338.        - cda52d9d-e7bd-468e-91d9-d51ffa33abd1
  339.         - cda52d9d-e7bd-468e-91d9-d51ffa33abd1
  340.         - cda52d9d-e7bd-468e-91d9-d51ffa33abd1
  341.         - cda52d9d-e7bd-468e-91d9-d51ffa33abd1
  342.         - cda52d9d-e7bd-468e-91d9-d51ffa33abd1
  343.         - cda52d9d-e7bd-468e-91d9-d51ffa33abd1
  344.         - cda52d9d-e7bd-468e-91d9-d51ffa33abd1
  345.         - cda52d9d-e7bd-468e-91d9-d51ffa33abd1
  346.     811c3c9c-8e1d-413a-b908-22829b94aa85:
  347.       size:
  348.         width: 60
  349.         height: 60
  350.       position:
  351.         x: 190
  352.         'y': 210
  353.       z: 3
  354.       parent: cda52d9d-e7bd-468e-91d9-d51ffa33abd1
  355.       embeds: []
  356.       iscontainedinside:
  357.        - cda52d9d-e7bd-468e-91d9-d51ffa33abd1
  358.         - cda52d9d-e7bd-468e-91d9-d51ffa33abd1
  359.         - cda52d9d-e7bd-468e-91d9-d51ffa33abd1
  360.         - cda52d9d-e7bd-468e-91d9-d51ffa33abd1
  361.         - cda52d9d-e7bd-468e-91d9-d51ffa33abd1
  362.         - cda52d9d-e7bd-468e-91d9-d51ffa33abd1
  363.         - cda52d9d-e7bd-468e-91d9-d51ffa33abd1
  364.         - cda52d9d-e7bd-468e-91d9-d51ffa33abd1
  365.     80af6f4c-1d4d-4f66-8237-11fbaa5d8061:
  366.       size:
  367.         width: 240
  368.         height: 240
  369.       position:
  370.         x: 40
  371.         'y': 500
  372.       z: 2
  373.       parent: 100906b8-589d-45d3-9633-4eb9e44ddbaf
  374.       embeds:
  375.        - 5467a301-e1f2-4320-93d1-c8c93b84306f
  376.       iscontainedinside:
  377.        - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  378.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  379.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  380.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  381.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  382.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  383.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  384.         - 100906b8-589d-45d3-9633-4eb9e44ddbaf
  385.     8db514ed-7e5f-42db-868e-e430d15b5bb8:
  386.       source:
  387.         id: c93e3089-9729-4403-b730-6737ff99ad2a
  388.       target:
  389.         id: 80af6f4c-1d4d-4f66-8237-11fbaa5d8061
  390.       z: 2
  391.     455b97eb-821c-4699-a909-5fd0b44cabbd:
  392.       source:
  393.         id: cda52d9d-e7bd-468e-91d9-d51ffa33abd1
  394.       target:
  395.         id: 80af6f4c-1d4d-4f66-8237-11fbaa5d8061
  396.       z: 2
  397.     5467a301-e1f2-4320-93d1-c8c93b84306f:
  398.       size:
  399.         width: 60
  400.         height: 60
  401.       position:
  402.         x: 70
  403.         'y': 560
  404.       z: 3
  405.       parent: 80af6f4c-1d4d-4f66-8237-11fbaa5d8061
  406.       embeds: []
  407.       iscontainedinside:
  408.        - 80af6f4c-1d4d-4f66-8237-11fbaa5d8061
  409.         - 80af6f4c-1d4d-4f66-8237-11fbaa5d8061
  410.         - 80af6f4c-1d4d-4f66-8237-11fbaa5d8061
  411.         - 80af6f4c-1d4d-4f66-8237-11fbaa5d8061
  412.         - 80af6f4c-1d4d-4f66-8237-11fbaa5d8061
  413.         - 80af6f4c-1d4d-4f66-8237-11fbaa5d8061
  414.         - 80af6f4c-1d4d-4f66-8237-11fbaa5d8061
  415.         - 80af6f4c-1d4d-4f66-8237-11fbaa5d8061
  416.     1f2155f4-d323-494e-b157-1e0a8c2f338c:
  417.       size:
  418.         width: 60
  419.         height: 60
  420.       position:
  421.         x: -120
  422.         'y': 140
  423.       z: 0
  424.       embeds: []
  425.     4e13c20d-0335-44e7-a6f4-d8a27ee8642c:
  426.       source:
  427.         id: 100906b8-589d-45d3-9633-4eb9e44ddbaf
  428.       target:
  429.         id: 1f2155f4-d323-494e-b157-1e0a8c2f338c
  430.       z: 2
  431.     16e7a5e4-f13b-4591-b6c8-3722c22f229f:
  432.       source:
  433.         id: 100906b8-589d-45d3-9633-4eb9e44ddbaf
  434.       target:
  435.         id: 6c215780-cc5d-4f7c-9029-f833506b0ab6
  436.       z: 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement