AWS Cloud Development Kitをためしてみる (Typescript)

AWS Cloud Development Kitを試してみます。ここではgithubに用意されたサンプルを動かしてみます。
サンプルにある、aws-cdk/examples/cdk-examples-typescript/hello-cdk-ecs/index.tsが39行なのに対して、テンプレートに変換すると798行なのでかなりコード量が少なくて住むことは確かですね。


##参考
https://github.com/awslabs/aws-cdk
https://awslabs.github.io/aws-cdk/

Getting started
https://awslabs.github.io/aws-cdk/getting-started.html

コードの書き方
https://awslabs.github.io/aws-cdk/reference.html

##前提

```
$ node -v
v10.0.0
```


##事前
###aws-cdkインストール

```
$ npm install -g aws-cdk
/Users/atsum/.nodebrew/node/v10.0.0/bin/cdk -> /Users/atsum/.nodebrew/node/v10.0.0/lib/node_modules/aws-cdk/bin/cdk
+ aws-cdk@0.18.1
updated 1 package in 17.502s
```

```
$ cdk --version
0.18.1 (build 9f7af21)
```

###プロジェクト作成

```
$ mkdir hello-world
$ cd hello-world/
$ git init
Initialized empty Git repository in /Users/atsum/Work/cdk/hello-cdk/hello-world/.git/
$ npm init -y
Wrote to /Users/atsum/Work/cdk/hello-cdk/hello-world/package.json:

{
  "name": "hello-world",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}
```

```
$ emacs tsconfig.json
$ cat tsconfig.json 
{
    "compilerOptions": {
        "target": "es2018",
        "module": "commonjs"
    }
}
```

```
$ emacs package.json 
{
  "name": "hello-world",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
        "build": "tsc",
        "watch": "tsc -w"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@aws-cdk/cdk": "^0.18.1",
    "@aws-cdk/aws-ec2": "^0.18.1",
    "@aws-cdk/aws-ecs": "^0.18.1"
  }
}
```

```
$ npm install
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN hello-world@1.0.0 No description
npm WARN hello-world@1.0.0 No repository field.

added 36 packages in 6.235s
```

```
$ emacs cdk.json 
{
  "app": "node index.js"
}
```

###exampleを動かす

```
$ git clone https://github.com/awslabs/aws-cdk.git
Cloning into 'aws-cdk'...
remote: Enumerating objects: 366, done.
remote: Counting objects: 100% (366/36
```

内容

```
$ cat aws-cdk/examples/cdk-examples-typescript/hello-cdk-ecs/index.ts 

import ec2 = require('@aws-cdk/aws-ec2');
import { InstanceType } from '@aws-cdk/aws-ec2';
import ecs = require('@aws-cdk/aws-ecs');
import cdk = require('@aws-cdk/cdk');

class BonjourECS extends cdk.Stack {
  constructor(parent: cdk.App, name: string, props?: cdk.StackProps) {
    super(parent, name, props);

    // For better iteration speed, it might make sense to put this VPC into
    // a separate stack and import it here. We then have two stacks to
    // deploy, but VPC creation is slow so we'll only have to do that once
    // and can iterate quickly on consuming stacks. Not doing that for now.
    const vpc = new ec2.VpcNetwork(this, 'MyVpc', { maxAZs: 2 });
    const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc });
    cluster.addDefaultAutoScalingGroupCapacity({
      instanceType: new InstanceType("t2.xlarge"),
      instanceCount: 3,
    });

    // Instantiate ECS Service with just cluster and image
    const ecsService = new ecs.LoadBalancedEc2Service(this, "Ec2Service", {
      cluster,
      memoryLimitMiB: 512,
      image: ecs.ContainerImage.fromDockerHub("amazon/amazon-ecs-sample"),
    });

    // ecsService.addTracing

    // Output the DNS where you can access your service
    new cdk.Output(this, 'LoadBalancerDNS', { value: ecsService.loadBalancer.dnsName });
  }
}

const app = new cdk.App();

new BonjourECS(app, 'Bonjour');

app.run();
```


```
cp aws-cdk/examples/cdk-examples-typescript/hello-cdk-ecs/index.ts .
```

ビルド

```
$ npm run build

> hello-world@1.0.0 build /Users/atsum/Work/cdk/hello-cdk/hello-world
> tsc
```

テンプレートを作成してみる

```
$ cdk list
Bonjour
$ cdk synth Bonjour
Resources:
  MyVpcF9F0CA6F:
    Type: AWS::EC2::VPC
    Properties:
      CidrBlock: 10.0.0.0/16
      EnableDnsHostnames: true
      EnableDnsSupport: true
      InstanceTenancy: default
      Tags:
        - Key: Name
          Value: Bonjour/MyVpc
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/Resource
  MyVpcPublicSubnet1SubnetF6608456:
    Type: AWS::EC2::Subnet
    Properties:
      CidrBlock: 10.0.0.0/18
      VpcId:
        Ref: MyVpcF9F0CA6F
      AvailabilityZone: ap-northeast-1a
      MapPublicIpOnLaunch: true
      Tags:
        - Key: Name
          Value: Bonjour/MyVpc/PublicSubnet1
        - Key: aws-cdk:subnet-name
          Value: Public
        - Key: aws-cdk:subnet-type
          Value: Public
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/PublicSubnet1/Subnet
  MyVpcPublicSubnet1RouteTableC46AB2F4:
    Type: AWS::EC2::RouteTable
    Properties:
      VpcId:
        Ref: MyVpcF9F0CA6F
      Tags:
        - Key: Name
          Value: Bonjour/MyVpc/PublicSubnet1
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/PublicSubnet1/RouteTable
  MyVpcPublicSubnet1RouteTableAssociation2ECEE1CB:
    Type: AWS::EC2::SubnetRouteTableAssociation
    Properties:
      RouteTableId:
        Ref: MyVpcPublicSubnet1RouteTableC46AB2F4
      SubnetId:
        Ref: MyVpcPublicSubnet1SubnetF6608456
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/PublicSubnet1/RouteTableAssociation
  MyVpcPublicSubnet1DefaultRoute95FDF9EB:
    Type: AWS::EC2::Route
    Properties:
      RouteTableId:
        Ref: MyVpcPublicSubnet1RouteTableC46AB2F4
      DestinationCidrBlock: 0.0.0.0/0
      GatewayId:
        Ref: MyVpcIGW5C4A4F63
    DependsOn:
      - MyVpcVPCGW488ACE0D
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/PublicSubnet1/DefaultRoute
  MyVpcPublicSubnet1EIP096967CB:
    Type: AWS::EC2::EIP
    Properties:
      Domain: vpc
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/PublicSubnet1/EIP
  MyVpcPublicSubnet1NATGatewayAD3400C1:
    Type: AWS::EC2::NatGateway
    Properties:
      AllocationId:
        Fn::GetAtt:
          - MyVpcPublicSubnet1EIP096967CB
          - AllocationId
      SubnetId:
        Ref: MyVpcPublicSubnet1SubnetF6608456
      Tags:
        - Key: Name
          Value: Bonjour/MyVpc/PublicSubnet1
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/PublicSubnet1/NATGateway
  MyVpcPublicSubnet2Subnet492B6BFB:
    Type: AWS::EC2::Subnet
    Properties:
      CidrBlock: 10.0.64.0/18
      VpcId:
        Ref: MyVpcF9F0CA6F
      AvailabilityZone: ap-northeast-1c
      MapPublicIpOnLaunch: true
      Tags:
        - Key: Name
          Value: Bonjour/MyVpc/PublicSubnet2
        - Key: aws-cdk:subnet-name
          Value: Public
        - Key: aws-cdk:subnet-type
          Value: Public
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/PublicSubnet2/Subnet
  MyVpcPublicSubnet2RouteTable1DF17386:
    Type: AWS::EC2::RouteTable
    Properties:
      VpcId:
        Ref: MyVpcF9F0CA6F
      Tags:
        - Key: Name
          Value: Bonjour/MyVpc/PublicSubnet2
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/PublicSubnet2/RouteTable
  MyVpcPublicSubnet2RouteTableAssociation227DE78D:
    Type: AWS::EC2::SubnetRouteTableAssociation
    Properties:
      RouteTableId:
        Ref: MyVpcPublicSubnet2RouteTable1DF17386
      SubnetId:
        Ref: MyVpcPublicSubnet2Subnet492B6BFB
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/PublicSubnet2/RouteTableAssociation
  MyVpcPublicSubnet2DefaultRoute052936F6:
    Type: AWS::EC2::Route
    Properties:
      RouteTableId:
        Ref: MyVpcPublicSubnet2RouteTable1DF17386
      DestinationCidrBlock: 0.0.0.0/0
      GatewayId:
        Ref: MyVpcIGW5C4A4F63
    DependsOn:
      - MyVpcVPCGW488ACE0D
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/PublicSubnet2/DefaultRoute
  MyVpcPublicSubnet2EIP8CCBA239:
    Type: AWS::EC2::EIP
    Properties:
      Domain: vpc
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/PublicSubnet2/EIP
  MyVpcPublicSubnet2NATGateway91BFBEC9:
    Type: AWS::EC2::NatGateway
    Properties:
      AllocationId:
        Fn::GetAtt:
          - MyVpcPublicSubnet2EIP8CCBA239
          - AllocationId
      SubnetId:
        Ref: MyVpcPublicSubnet2Subnet492B6BFB
      Tags:
        - Key: Name
          Value: Bonjour/MyVpc/PublicSubnet2
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/PublicSubnet2/NATGateway
  MyVpcPrivateSubnet1Subnet5057CF7E:
    Type: AWS::EC2::Subnet
    Properties:
      CidrBlock: 10.0.128.0/18
      VpcId:
        Ref: MyVpcF9F0CA6F
      AvailabilityZone: ap-northeast-1a
      MapPublicIpOnLaunch: false
      Tags:
        - Key: Name
          Value: Bonjour/MyVpc/PrivateSubnet1
        - Key: aws-cdk:subnet-name
          Value: Private
        - Key: aws-cdk:subnet-type
          Value: Private
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/PrivateSubnet1/Subnet
  MyVpcPrivateSubnet1RouteTable8819E6E2:
    Type: AWS::EC2::RouteTable
    Properties:
      VpcId:
        Ref: MyVpcF9F0CA6F
      Tags:
        - Key: Name
          Value: Bonjour/MyVpc/PrivateSubnet1
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/PrivateSubnet1/RouteTable
  MyVpcPrivateSubnet1RouteTableAssociation56D38C7E:
    Type: AWS::EC2::SubnetRouteTableAssociation
    Properties:
      RouteTableId:
        Ref: MyVpcPrivateSubnet1RouteTable8819E6E2
      SubnetId:
        Ref: MyVpcPrivateSubnet1Subnet5057CF7E
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/PrivateSubnet1/RouteTableAssociation
  MyVpcPrivateSubnet1DefaultRouteA8CDE2FA:
    Type: AWS::EC2::Route
    Properties:
      RouteTableId:
        Ref: MyVpcPrivateSubnet1RouteTable8819E6E2
      DestinationCidrBlock: 0.0.0.0/0
      NatGatewayId:
        Ref: MyVpcPublicSubnet1NATGatewayAD3400C1
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/PrivateSubnet1/DefaultRoute
  MyVpcPrivateSubnet2Subnet0040C983:
    Type: AWS::EC2::Subnet
    Properties:
      CidrBlock: 10.0.192.0/18
      VpcId:
        Ref: MyVpcF9F0CA6F
      AvailabilityZone: ap-northeast-1c
      MapPublicIpOnLaunch: false
      Tags:
        - Key: Name
          Value: Bonjour/MyVpc/PrivateSubnet2
        - Key: aws-cdk:subnet-name
          Value: Private
        - Key: aws-cdk:subnet-type
          Value: Private
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/PrivateSubnet2/Subnet
  MyVpcPrivateSubnet2RouteTableCEDCEECE:
    Type: AWS::EC2::RouteTable
    Properties:
      VpcId:
        Ref: MyVpcF9F0CA6F
      Tags:
        - Key: Name
          Value: Bonjour/MyVpc/PrivateSubnet2
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/PrivateSubnet2/RouteTable
  MyVpcPrivateSubnet2RouteTableAssociation86A610DA:
    Type: AWS::EC2::SubnetRouteTableAssociation
    Properties:
      RouteTableId:
        Ref: MyVpcPrivateSubnet2RouteTableCEDCEECE
      SubnetId:
        Ref: MyVpcPrivateSubnet2Subnet0040C983
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/PrivateSubnet2/RouteTableAssociation
  MyVpcPrivateSubnet2DefaultRoute9CE96294:
    Type: AWS::EC2::Route
    Properties:
      RouteTableId:
        Ref: MyVpcPrivateSubnet2RouteTableCEDCEECE
      DestinationCidrBlock: 0.0.0.0/0
      NatGatewayId:
        Ref: MyVpcPublicSubnet2NATGateway91BFBEC9
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/PrivateSubnet2/DefaultRoute
  MyVpcIGW5C4A4F63:
    Type: AWS::EC2::InternetGateway
    Properties:
      Tags:
        - Key: Name
          Value: Bonjour/MyVpc
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/IGW
  MyVpcVPCGW488ACE0D:
    Type: AWS::EC2::VPCGatewayAttachment
    Properties:
      VpcId:
        Ref: MyVpcF9F0CA6F
      InternetGatewayId:
        Ref: MyVpcIGW5C4A4F63
    Metadata:
      aws:cdk:path: Bonjour/MyVpc/VPCGW
  Ec2ClusterEE43E89D:
    Type: AWS::ECS::Cluster
    Metadata:
      aws:cdk:path: Bonjour/Ec2Cluster/Resource
  Ec2ClusterDefaultAutoScalingGroupInstanceSecurityGroup149B0A9E:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: Bonjour/Ec2Cluster/DefaultAutoScalingGroup/InstanceSecurityGroup
      SecurityGroupEgress:
        - CidrIp: 0.0.0.0/0
          Description: Allow all outbound traffic by default
          IpProtocol: "-1"
      SecurityGroupIngress:
        []
      Tags:
        - Key: Name
          Value: Bonjour/Ec2Cluster/DefaultAutoScalingGroup
      VpcId:
        Ref: MyVpcF9F0CA6F
    Metadata:
      aws:cdk:path: Bonjour/Ec2Cluster/DefaultAutoScalingGroup/InstanceSecurityGroup/Resource
  Ec2ClusterDefaultAutoScalingGroupInstanceSecurityGroupfromBonjourEc2ServiceLBSecurityGroup2185A60D3276865535EC4EE766:
    Type: AWS::EC2::SecurityGroupIngress
    Properties:
      IpProtocol: tcp
      Description: Load balancer to target
      FromPort: 32768
      GroupId:
        Fn::GetAtt:
          - Ec2ClusterDefaultAutoScalingGroupInstanceSecurityGroup149B0A9E
          - GroupId
      SourceSecurityGroupId:
        Fn::GetAtt:
          - Ec2ServiceLBSecurityGroup45FED6DF
          - GroupId
      ToPort: 65535
    Metadata:
      aws:cdk:path: Bonjour/Ec2Cluster/DefaultAutoScalingGroup/InstanceSecurityGroup/from
        BonjourEc2ServiceLBSecurityGroup2185A60D:32768-65535
  Ec2ClusterDefaultAutoScalingGroupInstanceRole73D80898:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: sts:AssumeRole
            Effect: Allow
            Principal:
              Service: ec2.amazonaws.com
        Version: "2012-10-17"
    Metadata:
      aws:cdk:path: Bonjour/Ec2Cluster/DefaultAutoScalingGroup/InstanceRole/Resource
  Ec2ClusterDefaultAutoScalingGroupInstanceRoleDefaultPolicy6D2DC2FD:
    Type: AWS::IAM::Policy
    Properties:
      PolicyDocument:
        Statement:
          - Action:
              - ecs:CreateCluster
              - ecs:DeregisterContainerInstance
              - ecs:DiscoverPollEndpoint
              - ecs:Poll
              - ecs:RegisterContainerInstance
              - ecs:StartTelemetrySession
              - ecs:Submit*
              - ecr:GetAuthorizationToken
              - logs:CreateLogStream
              - logs:PutLogEvents
            Effect: Allow
            Resource: "*"
        Version: "2012-10-17"
      PolicyName: Ec2ClusterDefaultAutoScalingGroupInstanceRoleDefaultPolicy6D2DC2FD
      Roles:
        - Ref: Ec2ClusterDefaultAutoScalingGroupInstanceRole73D80898
    Metadata:
      aws:cdk:path: Bonjour/Ec2Cluster/DefaultAutoScalingGroup/InstanceRole/DefaultPolicy/Resource
  Ec2ClusterDefaultAutoScalingGroupInstanceProfileDB232471:
    Type: AWS::IAM::InstanceProfile
    Properties:
      Roles:
        - Ref: Ec2ClusterDefaultAutoScalingGroupInstanceRole73D80898
    Metadata:
      aws:cdk:path: Bonjour/Ec2Cluster/DefaultAutoScalingGroup/InstanceProfile
  Ec2ClusterDefaultAutoScalingGroupLaunchConfig7B2FED3A:
    Type: AWS::AutoScaling::LaunchConfiguration
    Properties:
      ImageId: ami-05b296a384694dfa4
      InstanceType: t2.xlarge
      IamInstanceProfile:
        Ref: Ec2ClusterDefaultAutoScalingGroupInstanceProfileDB232471
      SecurityGroups:
        - Fn::GetAtt:
            - Ec2ClusterDefaultAutoScalingGroupInstanceSecurityGroup149B0A9E
            - GroupId
      UserData:
        Fn::Base64:
          Fn::Join:
            - ""
            - - |-
                #!/bin/bash
                echo ECS_CLUSTER=
              - Ref: Ec2ClusterEE43E89D
              - >-2
                 >> /etc/ecs/ecs.config
                sudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP

                sudo service iptables save

                echo ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config
    DependsOn:
      - Ec2ClusterDefaultAutoScalingGroupInstanceRole73D80898
      - Ec2ClusterDefaultAutoScalingGroupInstanceRoleDefaultPolicy6D2DC2FD
    Metadata:
      aws:cdk:path: Bonjour/Ec2Cluster/DefaultAutoScalingGroup/LaunchConfig
  Ec2ClusterDefaultAutoScalingGroupASGC5A6D4C0:
    Type: AWS::AutoScaling::AutoScalingGroup
    Properties:
      MaxSize: "3"
      MinSize: "1"
      DesiredCapacity: "3"
      LaunchConfigurationName:
        Ref: Ec2ClusterDefaultAutoScalingGroupLaunchConfig7B2FED3A
      Tags:
        - Key: Name
          PropagateAtLaunch: true
          Value: Bonjour/Ec2Cluster/DefaultAutoScalingGroup
      VPCZoneIdentifier:
        - Ref: MyVpcPrivateSubnet1Subnet5057CF7E
        - Ref: MyVpcPrivateSubnet2Subnet0040C983
    UpdatePolicy:
      AutoScalingReplacingUpdate:
        WillReplace: true
      AutoScalingScheduledAction:
        IgnoreUnmodifiedGroupSizeProperties: true
    Metadata:
      aws:cdk:path: Bonjour/Ec2Cluster/DefaultAutoScalingGroup/ASG
  Ec2ClusterDefaultAutoScalingGroupDrainECSHookTopic798CDC5F:
    Type: AWS::SNS::Topic
    Metadata:
      aws:cdk:path: Bonjour/Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Topic/Resource
  Ec2ClusterDefaultAutoScalingGroupDrainECSHookTopicFunctionSubscription5FABD83E:
    Type: AWS::SNS::Subscription
    Properties:
      Endpoint:
        Fn::GetAtt:
          - Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionE0DEFB31
          - Arn
      Protocol: lambda
      TopicArn:
        Ref: Ec2ClusterDefaultAutoScalingGroupDrainECSHookTopic798CDC5F
    Metadata:
      aws:cdk:path: Bonjour/Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Topic/FunctionSubscription/Resource
  Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionServiceRole23116FA3:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: sts:AssumeRole
            Effect: Allow
            Principal:
              Service: lambda.amazonaws.com
        Version: "2012-10-17"
      ManagedPolicyArns:
        - Fn::Join:
            - ""
            - - "arn:"
              - Ref: AWS::Partition
              - :iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
    Metadata:
      aws:cdk:path: Bonjour/Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Function/ServiceRole/Resource
  Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionServiceRoleDefaultPolicy638C9E33:
    Type: AWS::IAM::Policy
    Properties:
      PolicyDocument:
        Statement:
          - Action:
              - autoscaling:CompleteLifecycleAction
              - ec2:DescribeInstances
              - ec2:DescribeInstanceAttribute
              - ec2:DescribeInstanceStatus
              - ec2:DescribeHosts
            Effect: Allow
            Resource: "*"
          - Action:
              - ecs:ListContainerInstances
              - ecs:SubmitContainerStateChange
              - ecs:SubmitTaskStateChange
              - ecs:DescribeContainerInstances
              - ecs:UpdateContainerInstancesState
              - ecs:ListTasks
              - ecs:DescribeTasks
            Effect: Allow
            Resource: "*"
        Version: "2012-10-17"
      PolicyName: Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionServiceRoleDefaultPolicy638C9E33
      Roles:
        - Ref: Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionServiceRole23116FA3
    Metadata:
      aws:cdk:path: Bonjour/Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Function/ServiceRole/DefaultPolicy/Resource
  Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionE0DEFB31:
    Type: AWS::Lambda::Function
    Properties:
      Code:
        ZipFile: >
          import boto3, json, os, time


          ecs = boto3.client('ecs')

          autoscaling = boto3.client('autoscaling')



          def lambda_handler(event, context):
            print(json.dumps(event))
            cluster = os.environ['CLUSTER']
            snsTopicArn = event['Records'][0]['Sns']['TopicArn']
            lifecycle_event = json.loads(event['Records'][0]['Sns']['Message'])
            instance_id = lifecycle_event.get('EC2InstanceId')
            if not instance_id:
              print('Got event without EC2InstanceId: %s', json.dumps(event))
              return

            instance_arn = container_instance_arn(cluster, instance_id)
            print('Instance %s has container instance ARN %s' % (lifecycle_event['EC2InstanceId'], instance_arn))

            if not instance_arn:
              return

            while has_tasks(cluster, instance_arn):
              time.sleep(10)

            try:
              print('Terminating instance %s' % instance_id)
              autoscaling.complete_lifecycle_action(
                  LifecycleActionResult='CONTINUE',
                  **pick(lifecycle_event, 'LifecycleHookName', 'LifecycleActionToken', 'AutoScalingGroupName'))
            except Exception as e:
              # Lifecycle action may have already completed.
              print(str(e))


          def container_instance_arn(cluster, instance_id):
            """Turn an instance ID into a container instance ARN."""
            arns = ecs.list_container_instances(cluster=cluster, filter='ec2InstanceId==' + instance_id)['containerInstanceArns']
            if not arns:
              return None
            return arns[0]


          def has_tasks(cluster, instance_arn):
            """Return True if the instance is running tasks for the given cluster."""
            instances = ecs.describe_container_instances(cluster=cluster, containerInstances=[instance_arn])['containerInstances']
            if not instances:
              return False
            instance = instances[0]

            if instance['status'] == 'ACTIVE':
              # Start draining, then try again later
              set_container_instance_to_draining(cluster, instance_arn)
              return True

            tasks = instance['runningTasksCount'] + instance['pendingTasksCount']
            print('Instance %s has %s tasks' % (instance_arn, tasks))

            return tasks > 0


          def set_container_instance_to_draining(cluster, instance_arn):
            ecs.update_container_instances_state(
                cluster=cluster,
                containerInstances=[instance_arn], status='DRAINING')


          def pick(dct, *keys):
            """Pick a subset of a dict."""
            return {k: v for k, v in dct.items() if k in keys}
      Handler: index.lambda_handler
      Role:
        Fn::GetAtt:
          - Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionServiceRole23116FA3
          - Arn
      Runtime: python3.6
      Environment:
        Variables:
          CLUSTER:
            Ref: Ec2ClusterEE43E89D
      Timeout: 310
    DependsOn:
      - Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionServiceRole23116FA3
      - Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionServiceRoleDefaultPolicy638C9E33
    Metadata:
      aws:cdk:path: Bonjour/Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Function/Resource
  Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionTopic6C30136B:
    Type: AWS::Lambda::Permission
    Properties:
      Action: lambda:InvokeFunction
      FunctionName:
        Ref: Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionE0DEFB31
      Principal: sns.amazonaws.com
      SourceArn:
        Ref: Ec2ClusterDefaultAutoScalingGroupDrainECSHookTopic798CDC5F
    Metadata:
      aws:cdk:path: Bonjour/Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Function/Topic
  Ec2ClusterDefaultAutoScalingGroupLifecycleHookDrainHookRole71045ED7:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: sts:AssumeRole
            Effect: Allow
            Principal:
              Service: autoscaling.amazonaws.com
        Version: "2012-10-17"
    Metadata:
      aws:cdk:path: Bonjour/Ec2Cluster/DefaultAutoScalingGroup/LifecycleHookDrainHook/Role/Resource
  Ec2ClusterDefaultAutoScalingGroupLifecycleHookDrainHookRoleDefaultPolicyE499974B:
    Type: AWS::IAM::Policy
    Properties:
      PolicyDocument:
        Statement:
          - Action: sns:Publish
            Effect: Allow
            Resource:
              Ref: Ec2ClusterDefaultAutoScalingGroupDrainECSHookTopic798CDC5F
        Version: "2012-10-17"
      PolicyName: Ec2ClusterDefaultAutoScalingGroupLifecycleHookDrainHookRoleDefaultPolicyE499974B
      Roles:
        - Ref: Ec2ClusterDefaultAutoScalingGroupLifecycleHookDrainHookRole71045ED7
    Metadata:
      aws:cdk:path: Bonjour/Ec2Cluster/DefaultAutoScalingGroup/LifecycleHookDrainHook/Role/DefaultPolicy/Resource
  Ec2ClusterDefaultAutoScalingGroupLifecycleHookDrainHook5CB1467E:
    Type: AWS::AutoScaling::LifecycleHook
    Properties:
      AutoScalingGroupName:
        Ref: Ec2ClusterDefaultAutoScalingGroupASGC5A6D4C0
      LifecycleTransition: autoscaling:EC2_INSTANCE_TERMINATING
      DefaultResult: CONTINUE
      HeartbeatTimeout: 300
      NotificationTargetARN:
        Ref: Ec2ClusterDefaultAutoScalingGroupDrainECSHookTopic798CDC5F
      RoleARN:
        Fn::GetAtt:
          - Ec2ClusterDefaultAutoScalingGroupLifecycleHookDrainHookRole71045ED7
          - Arn
    DependsOn:
      - Ec2ClusterDefaultAutoScalingGroupLifecycleHookDrainHookRole71045ED7
      - Ec2ClusterDefaultAutoScalingGroupLifecycleHookDrainHookRoleDefaultPolicyE499974B
    Metadata:
      aws:cdk:path: Bonjour/Ec2Cluster/DefaultAutoScalingGroup/LifecycleHookDrainHook/Resource
  Ec2ServiceTaskDefTaskRole27A5D642:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: sts:AssumeRole
            Effect: Allow
            Principal:
              Service: ecs-tasks.amazonaws.com
        Version: "2012-10-17"
    Metadata:
      aws:cdk:path: Bonjour/Ec2Service/TaskDef/TaskRole/Resource
  Ec2ServiceTaskDef8D94BAA3:
    Type: AWS::ECS::TaskDefinition
    Properties:
      ContainerDefinitions:
        - Essential: true
          Image: amazon/amazon-ecs-sample
          Links:
            []
          LinuxParameters:
            Capabilities:
              Add:
                []
              Drop:
                []
            Devices:
              []
            Tmpfs:
              []
          Memory: 512
          MountPoints:
            []
          Name: web
          PortMappings:
            - ContainerPort: 80
              HostPort: 0
              Protocol: tcp
          Ulimits:
            []
          VolumesFrom:
            []
      Family: BonjourEc2ServiceTaskDef2C3EE7C1
      NetworkMode: bridge
      PlacementConstraints:
        []
      RequiresCompatibilities:
        - EC2
      TaskRoleArn:
        Fn::GetAtt:
          - Ec2ServiceTaskDefTaskRole27A5D642
          - Arn
      Volumes:
        []
    Metadata:
      aws:cdk:path: Bonjour/Ec2Service/TaskDef/Resource
  Ec2Service398F0E46:
    Type: AWS::ECS::Service
    Properties:
      TaskDefinition:
        Ref: Ec2ServiceTaskDef8D94BAA3
      Cluster:
        Ref: Ec2ClusterEE43E89D
      DeploymentConfiguration:
        MaximumPercent: 200
        MinimumHealthyPercent: 50
      DesiredCount: 1
      LaunchType: EC2
      LoadBalancers:
        - ContainerName: web
          ContainerPort: 80
          TargetGroupArn:
            Ref: Ec2ServiceLBPublicListenerECSGroup3DC8690E
      PlacementConstraints:
        []
      PlacementStrategies:
        []
      SchedulingStrategy: REPLICA
    DependsOn:
      - Ec2ServiceLBPublicListenerA941070C
    Metadata:
      aws:cdk:path: Bonjour/Ec2Service/Service/Service
  Ec2ServiceLB381329CE:
    Type: AWS::ElasticLoadBalancingV2::LoadBalancer
    Properties:
      LoadBalancerAttributes:
        []
      Scheme: internet-facing
      SecurityGroups:
        - Fn::GetAtt:
            - Ec2ServiceLBSecurityGroup45FED6DF
            - GroupId
      Subnets:
        - Ref: MyVpcPublicSubnet1SubnetF6608456
        - Ref: MyVpcPublicSubnet2Subnet492B6BFB
      Type: application
    Metadata:
      aws:cdk:path: Bonjour/Ec2Service/LB/Resource
  Ec2ServiceLBSecurityGroup45FED6DF:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: Automatically created Security Group for ELB BonjourEc2ServiceLB066AC4BC
      SecurityGroupEgress:
        []
      SecurityGroupIngress:
        - CidrIp: 0.0.0.0/0
          Description: Allow from anyone on port 80
          FromPort: 80
          IpProtocol: tcp
          ToPort: 80
      VpcId:
        Ref: MyVpcF9F0CA6F
    Metadata:
      aws:cdk:path: Bonjour/Ec2Service/LB/SecurityGroup/Resource
  Ec2ServiceLBSecurityGrouptoBonjourEc2ClusterDefaultAutoScalingGroupInstanceSecurityGroupE49ADAF53276865535AC4204BB:
    Type: AWS::EC2::SecurityGroupEgress
    Properties:
      GroupId:
        Fn::GetAtt:
          - Ec2ServiceLBSecurityGroup45FED6DF
          - GroupId
      IpProtocol: tcp
      Description: Load balancer to target
      DestinationSecurityGroupId:
        Fn::GetAtt:
          - Ec2ClusterDefaultAutoScalingGroupInstanceSecurityGroup149B0A9E
          - GroupId
      FromPort: 32768
      ToPort: 65535
    Metadata:
      aws:cdk:path: Bonjour/Ec2Service/LB/SecurityGroup/to
        BonjourEc2ClusterDefaultAutoScalingGroupInstanceSecurityGroupE49ADAF5:32768-65535
  Ec2ServiceLBPublicListenerA941070C:
    Type: AWS::ElasticLoadBalancingV2::Listener
    Properties:
      DefaultActions:
        - TargetGroupArn:
            Ref: Ec2ServiceLBPublicListenerECSGroup3DC8690E
          Type: forward
      LoadBalancerArn:
        Ref: Ec2ServiceLB381329CE
      Port: 80
      Protocol: HTTP
      Certificates:
        []
    Metadata:
      aws:cdk:path: Bonjour/Ec2Service/LB/PublicListener/Resource
  Ec2ServiceLBPublicListenerECSGroup3DC8690E:
    Type: AWS::ElasticLoadBalancingV2::TargetGroup
    Properties:
      Port: 80
      Protocol: HTTP
      VpcId:
        Ref: MyVpcF9F0CA6F
      TargetGroupAttributes:
        []
      Targets:
        []
      TargetType: instance
    Metadata:
      aws:cdk:path: Bonjour/Ec2Service/LB/PublicListener/ECSGroup/Resource
  CDKMetadata:
    Type: AWS::CDK::Metadata
    Properties:
      Modules: "@aws-cdk/assets=0.18.1,@aws-cdk/aws-applicationautoscaling=0.18.1,@aws\
        -cdk/aws-autoscaling=0.18.1,@aws-cdk/aws-autoscaling-common=0.18.1,@aws\
        -cdk/aws-certificatemanager=0.18.1,@aws-cdk/aws-cloudformation=0.18.1,@\
        aws-cdk/aws-cloudwatch=0.18.1,@aws-cdk/aws-codedeploy-api=0.18.1,@aws-c\
        dk/aws-codepipeline-api=0.18.1,@aws-cdk/aws-ec2=0.18.1,@aws-cdk/aws-ecr\
        =0.18.1,@aws-cdk/aws-ecs=0.18.1,@aws-cdk/aws-elasticloadbalancingv2=0.1\
        8.1,@aws-cdk/aws-events=0.18.1,@aws-cdk/aws-iam=0.18.1,@aws-cdk/aws-kms\
        =0.18.1,@aws-cdk/aws-lambda=0.18.1,@aws-cdk/aws-logs=0.18.1,@aws-cdk/aw\
        s-route53=0.18.1,@aws-cdk/aws-s3=0.18.1,@aws-cdk/aws-s3-notifications=0\
        .18.1,@aws-cdk/aws-sns=0.18.1,@aws-cdk/aws-sqs=0.18.1,@aws-cdk/cdk=0.18\
        .1,@aws-cdk/cx-api=0.18.1,hello-world=1.0.0"
Outputs:
  Ec2ServiceLoadBalancerDNS6983C9B2:
    Value:
      Fn::GetAtt:
        - Ec2ServiceLB381329CE
        - DNSName
    Export:
      Name: Bonjour:Ec2ServiceLoadBalancerDNS6983C9B2
  LoadBalancerDNS:
    Value:
      Fn::GetAtt:
        - Ec2ServiceLB381329CE
        - DNSName
    Export:
      Name: Bonjour:LoadBalancerDNS

8c8590130da5:hello-world atsum$ cdk ls -l
- name: Bonjour
  environment:
    name: ******/ap-northeast-1
    account: "******"
    region: ap-northeast-1
```

スタック作成

```
$ cdk deploy
Bonjour: deploying...
Bonjour: creating CloudFormation changeset...
  0/50 | 14:48:22 | CREATE_IN_PROGRESS   | AWS::ECS::Cluster                         | Ec2Cluster (Ec2ClusterEE43E89D) 
  0/50 | 14:48:23 | CREATE_IN_PROGRESS   | AWS::IAM::Role                            | Ec2Cluster/DefaultAutoScalingGroup/LifecycleHookDrainHook/Role (Ec2ClusterDefaultAutoScalingGroupLifecycleHookDrainHookRole71045ED7) 
  0/50 | 14:48:23 | CREATE_IN_PROGRESS   | AWS::EC2::EIP                             | MyVpc/PublicSubnet1/EIP (MyVpcPublicSubnet1EIP096967CB) 
  0/50 | 14:48:23 | CREATE_IN_PROGRESS   | AWS::CDK::Metadata                        | CDKMetadata 
  0/50 | 14:48:23 | CREATE_IN_PROGRESS   | AWS::EC2::VPC                             | MyVpc (MyVpcF9F0CA6F) 
  0/50 | 14:48:23 | CREATE_IN_PROGRESS   | AWS::IAM::Role                            | Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Function/ServiceRole (Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionServiceRole23116FA3) 
  0/50 | 14:48:23 | CREATE_IN_PROGRESS   | AWS::EC2::EIP                             | MyVpc/PublicSubnet2/EIP (MyVpcPublicSubnet2EIP8CCBA239) 
  0/50 | 14:48:23 | CREATE_IN_PROGRESS   | AWS::IAM::Role                            | Ec2Cluster/DefaultAutoScalingGroup/InstanceRole (Ec2ClusterDefaultAutoScalingGroupInstanceRole73D80898) 
  0/50 | 14:48:23 | CREATE_IN_PROGRESS   | AWS::IAM::Role                            | Ec2Service/TaskDef/TaskRole (Ec2ServiceTaskDefTaskRole27A5D642) 
  0/50 | 14:48:23 | CREATE_IN_PROGRESS   | AWS::ECS::Cluster                         | Ec2Cluster (Ec2ClusterEE43E89D) Resource creation Initiated
  0/50 | 14:48:23 | CREATE_IN_PROGRESS   | AWS::EC2::InternetGateway                 | MyVpc/IGW (MyVpcIGW5C4A4F63) 
  0/50 | 14:48:23 | CREATE_IN_PROGRESS   | AWS::EC2::VPC                             | MyVpc (MyVpcF9F0CA6F) Resource creation Initiated
  0/50 | 14:48:23 | CREATE_IN_PROGRESS   | AWS::IAM::Role                            | Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Function/ServiceRole (Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionServiceRole23116FA3) Resource creation Initiated
  0/50 | 14:48:23 | CREATE_IN_PROGRESS   | AWS::EC2::EIP                             | MyVpc/PublicSubnet1/EIP (MyVpcPublicSubnet1EIP096967CB) Resource creation Initiated
  0/50 | 14:48:23 | CREATE_IN_PROGRESS   | AWS::SNS::Topic                           | Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Topic (Ec2ClusterDefaultAutoScalingGroupDrainECSHookTopic798CDC5F) 
  0/50 | 14:48:24 | CREATE_IN_PROGRESS   | AWS::IAM::Role                            | Ec2Service/TaskDef/TaskRole (Ec2ServiceTaskDefTaskRole27A5D642) Resource creation Initiated
  1/50 | 14:48:24 | CREATE_COMPLETE      | AWS::ECS::Cluster                         | Ec2Cluster (Ec2ClusterEE43E89D) 
  1/50 | 14:48:24 | CREATE_IN_PROGRESS   | AWS::EC2::EIP                             | MyVpc/PublicSubnet2/EIP (MyVpcPublicSubnet2EIP8CCBA239) Resource creation Initiated
  1/50 | 14:48:24 | CREATE_IN_PROGRESS   | AWS::IAM::Role                            | Ec2Cluster/DefaultAutoScalingGroup/LifecycleHookDrainHook/Role (Ec2ClusterDefaultAutoScalingGroupLifecycleHookDrainHookRole71045ED7) Resource creation Initiated
  1/50 | 14:48:24 | CREATE_IN_PROGRESS   | AWS::EC2::InternetGateway                 | MyVpc/IGW (MyVpcIGW5C4A4F63) Resource creation Initiated
  1/50 | 14:48:24 | CREATE_IN_PROGRESS   | AWS::SNS::Topic                           | Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Topic (Ec2ClusterDefaultAutoScalingGroupDrainECSHookTopic798CDC5F) Resource creation Initiated
  1/50 | 14:48:24 | CREATE_IN_PROGRESS   | AWS::IAM::Role                            | Ec2Cluster/DefaultAutoScalingGroup/InstanceRole (Ec2ClusterDefaultAutoScalingGroupInstanceRole73D80898) Resource creation Initiated
  1/50 | 14:48:25 | CREATE_IN_PROGRESS   | AWS::CDK::Metadata                        | CDKMetadata Resource creation Initiated
  2/50 | 14:48:26 | CREATE_COMPLETE      | AWS::CDK::Metadata                        | CDKMetadata 
  3/50 | 14:48:34 | CREATE_COMPLETE      | AWS::SNS::Topic                           | Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Topic (Ec2ClusterDefaultAutoScalingGroupDrainECSHookTopic798CDC5F) 
  4/50 | 14:48:39 | CREATE_COMPLETE      | AWS::EC2::EIP                             | MyVpc/PublicSubnet1/EIP (MyVpcPublicSubnet1EIP096967CB) 
  5/50 | 14:48:39 | CREATE_COMPLETE      | AWS::EC2::EIP                             | MyVpc/PublicSubnet2/EIP (MyVpcPublicSubnet2EIP8CCBA239) 
  6/50 | 14:48:40 | CREATE_COMPLETE      | AWS::EC2::InternetGateway                 | MyVpc/IGW (MyVpcIGW5C4A4F63) 
  7/50 | 14:48:40 | CREATE_COMPLETE      | AWS::EC2::VPC                             | MyVpc (MyVpcF9F0CA6F) 
  8/50 | 14:48:41 | CREATE_COMPLETE      | AWS::IAM::Role                            | Ec2Cluster/DefaultAutoScalingGroup/LifecycleHookDrainHook/Role (Ec2ClusterDefaultAutoScalingGroupLifecycleHookDrainHookRole71045ED7) 
  9/50 | 14:48:41 | CREATE_COMPLETE      | AWS::IAM::Role                            | Ec2Service/TaskDef/TaskRole (Ec2ServiceTaskDefTaskRole27A5D642) 
 10/50 | 14:48:41 | CREATE_COMPLETE      | AWS::IAM::Role                            | Ec2Cluster/DefaultAutoScalingGroup/InstanceRole (Ec2ClusterDefaultAutoScalingGroupInstanceRole73D80898) 
 11/50 | 14:48:41 | CREATE_COMPLETE      | AWS::IAM::Role                            | Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Function/ServiceRole (Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionServiceRole23116FA3) 
 11/50 | 14:48:43 | CREATE_IN_PROGRESS   | AWS::EC2::VPCGatewayAttachment            | MyVpc/VPCGW (MyVpcVPCGW488ACE0D) 
 11/50 | 14:48:43 | CREATE_IN_PROGRESS   | AWS::EC2::RouteTable                      | MyVpc/PrivateSubnet2/RouteTable (MyVpcPrivateSubnet2RouteTableCEDCEECE) 
 11/50 | 14:48:43 | CREATE_IN_PROGRESS   | AWS::EC2::RouteTable                      | MyVpc/PublicSubnet2/RouteTable (MyVpcPublicSubnet2RouteTable1DF17386) 
 11/50 | 14:48:43 | CREATE_IN_PROGRESS   | AWS::EC2::Subnet                          | MyVpc/PrivateSubnet1/Subnet (MyVpcPrivateSubnet1Subnet5057CF7E) 
 11/50 | 14:48:43 | CREATE_IN_PROGRESS   | AWS::EC2::RouteTable                      | MyVpc/PrivateSubnet1/RouteTable (MyVpcPrivateSubnet1RouteTable8819E6E2) 
 11/50 | 14:48:43 | CREATE_IN_PROGRESS   | AWS::EC2::SecurityGroup                   | Ec2Cluster/DefaultAutoScalingGroup/InstanceSecurityGroup (Ec2ClusterDefaultAutoScalingGroupInstanceSecurityGroup149B0A9E) 
 11/50 | 14:48:43 | CREATE_IN_PROGRESS   | AWS::EC2::SecurityGroup                   | Ec2Service/LB/SecurityGroup (Ec2ServiceLBSecurityGroup45FED6DF) 
 11/50 | 14:48:43 | CREATE_IN_PROGRESS   | AWS::EC2::Subnet                          | MyVpc/PublicSubnet1/Subnet (MyVpcPublicSubnet1SubnetF6608456) 
 11/50 | 14:48:43 | CREATE_IN_PROGRESS   | AWS::EC2::Subnet                          | MyVpc/PrivateSubnet2/Subnet (MyVpcPrivateSubnet2Subnet0040C983) 
 11/50 | 14:48:43 | CREATE_IN_PROGRESS   | AWS::EC2::RouteTable                      | MyVpc/PublicSubnet1/RouteTable (MyVpcPublicSubnet1RouteTableC46AB2F4) 
 11/50 | 14:48:43 | CREATE_IN_PROGRESS   | AWS::EC2::Subnet                          | MyVpc/PublicSubnet2/Subnet (MyVpcPublicSubnet2Subnet492B6BFB) 
 11/50 | 14:48:43 | CREATE_IN_PROGRESS   | AWS::ElasticLoadBalancingV2::TargetGroup  | Ec2Service/LB/PublicListener/ECSGroup (Ec2ServiceLBPublicListenerECSGroup3DC8690E) 
 11/50 | 14:48:44 | CREATE_IN_PROGRESS   | AWS::EC2::VPCGatewayAttachment            | MyVpc/VPCGW (MyVpcVPCGW488ACE0D) Resource creation Initiated
 11/50 | 14:48:44 | CREATE_IN_PROGRESS   | AWS::EC2::RouteTable                      | MyVpc/PublicSubnet2/RouteTable (MyVpcPublicSubnet2RouteTable1DF17386) Resource creation Initiated
 11/50 | 14:48:44 | CREATE_IN_PROGRESS   | AWS::EC2::RouteTable                      | MyVpc/PrivateSubnet2/RouteTable (MyVpcPrivateSubnet2RouteTableCEDCEECE) Resource creation Initiated
 11/50 | 14:48:44 | CREATE_IN_PROGRESS   | AWS::EC2::RouteTable                      | MyVpc/PrivateSubnet1/RouteTable (MyVpcPrivateSubnet1RouteTable8819E6E2) Resource creation Initiated
 11/50 | 14:48:44 | CREATE_IN_PROGRESS   | AWS::EC2::Subnet                          | MyVpc/PrivateSubnet1/Subnet (MyVpcPrivateSubnet1Subnet5057CF7E) Resource creation Initiated
 11/50 | 14:48:44 | CREATE_IN_PROGRESS   | AWS::EC2::Subnet                          | MyVpc/PrivateSubnet2/Subnet (MyVpcPrivateSubnet2Subnet0040C983) Resource creation Initiated
 11/50 | 14:48:44 | CREATE_IN_PROGRESS   | AWS::EC2::RouteTable                      | MyVpc/PublicSubnet1/RouteTable (MyVpcPublicSubnet1RouteTableC46AB2F4) Resource creation Initiated
 11/50 | 14:48:44 | CREATE_IN_PROGRESS   | AWS::EC2::Subnet                          | MyVpc/PublicSubnet1/Subnet (MyVpcPublicSubnet1SubnetF6608456) Resource creation Initiated
 11/50 | 14:48:44 | CREATE_IN_PROGRESS   | AWS::EC2::Subnet                          | MyVpc/PublicSubnet2/Subnet (MyVpcPublicSubnet2Subnet492B6BFB) Resource creation Initiated
 11/50 | 14:48:44 | CREATE_IN_PROGRESS   | AWS::ElasticLoadBalancingV2::TargetGroup  | Ec2Service/LB/PublicListener/ECSGroup (Ec2ServiceLBPublicListenerECSGroup3DC8690E) Resource creation Initiated
 11/50 | 14:48:44 | CREATE_IN_PROGRESS   | AWS::IAM::Policy                          | Ec2Cluster/DefaultAutoScalingGroup/LifecycleHookDrainHook/Role/DefaultPolicy (Ec2ClusterDefaultAutoScalingGroupLifecycleHookDrainHookRoleDefaultPolicyE499974B) 
 11/50 | 14:48:44 | CREATE_IN_PROGRESS   | AWS::IAM::Policy                          | Ec2Cluster/DefaultAutoScalingGroup/InstanceRole/DefaultPolicy (Ec2ClusterDefaultAutoScalingGroupInstanceRoleDefaultPolicy6D2DC2FD) 
 11/50 | 14:48:44 | CREATE_IN_PROGRESS   | AWS::IAM::Policy                          | Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Function/ServiceRole/DefaultPolicy (Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionServiceRoleDefaultPolicy638C9E33) 
 12/50 | 14:48:45 | CREATE_COMPLETE      | AWS::ElasticLoadBalancingV2::TargetGroup  | Ec2Service/LB/PublicListener/ECSGroup (Ec2ServiceLBPublicListenerECSGroup3DC8690E) 
 13/50 | 14:48:45 | CREATE_COMPLETE      | AWS::EC2::RouteTable                      | MyVpc/PublicSubnet2/RouteTable (MyVpcPublicSubnet2RouteTable1DF17386) 
 13/50 | 14:48:45 | CREATE_IN_PROGRESS   | AWS::IAM::InstanceProfile                 | Ec2Cluster/DefaultAutoScalingGroup/InstanceProfile (Ec2ClusterDefaultAutoScalingGroupInstanceProfileDB232471) 
 14/50 | 14:48:45 | CREATE_COMPLETE      | AWS::EC2::RouteTable                      | MyVpc/PrivateSubnet2/RouteTable (MyVpcPrivateSubnet2RouteTableCEDCEECE) 
 15/50 | 14:48:45 | CREATE_COMPLETE      | AWS::EC2::RouteTable                      | MyVpc/PrivateSubnet1/RouteTable (MyVpcPrivateSubnet1RouteTable8819E6E2) 
 15/50 | 14:48:45 | CREATE_IN_PROGRESS   | AWS::ECS::TaskDefinition                  | Ec2Service/TaskDef (Ec2ServiceTaskDef8D94BAA3) 
 16/50 | 14:48:45 | CREATE_COMPLETE      | AWS::EC2::RouteTable                      | MyVpc/PublicSubnet1/RouteTable (MyVpcPublicSubnet1RouteTableC46AB2F4) 
 16/50 | 14:48:45 | CREATE_IN_PROGRESS   | AWS::ECS::TaskDefinition                  | Ec2Service/TaskDef (Ec2ServiceTaskDef8D94BAA3) Resource creation Initiated
 17/50 | 14:48:45 | CREATE_COMPLETE      | AWS::ECS::TaskDefinition                  | Ec2Service/TaskDef (Ec2ServiceTaskDef8D94BAA3) 
 17/50 | 14:48:46 | CREATE_IN_PROGRESS   | AWS::IAM::Policy                          | Ec2Cluster/DefaultAutoScalingGroup/LifecycleHookDrainHook/Role/DefaultPolicy (Ec2ClusterDefaultAutoScalingGroupLifecycleHookDrainHookRoleDefaultPolicyE499974B) Resource creation Initiated
 17/50 | 14:48:46 | CREATE_IN_PROGRESS   | AWS::IAM::InstanceProfile                 | Ec2Cluster/DefaultAutoScalingGroup/InstanceProfile (Ec2ClusterDefaultAutoScalingGroupInstanceProfileDB232471) Resource creation Initiated
 17/50 | 14:48:46 | CREATE_IN_PROGRESS   | AWS::IAM::Policy                          | Ec2Cluster/DefaultAutoScalingGroup/InstanceRole/DefaultPolicy (Ec2ClusterDefaultAutoScalingGroupInstanceRoleDefaultPolicy6D2DC2FD) Resource creation Initiated
 17/50 | 14:48:46 | CREATE_IN_PROGRESS   | AWS::IAM::Policy                          | Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Function/ServiceRole/DefaultPolicy (Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionServiceRoleDefaultPolicy638C9E33) Resource creation Initiated
 17/50 | 14:48:48 | CREATE_IN_PROGRESS   | AWS::EC2::SecurityGroup                   | Ec2Cluster/DefaultAutoScalingGroup/InstanceSecurityGroup (Ec2ClusterDefaultAutoScalingGroupInstanceSecurityGroup149B0A9E) Resource creation Initiated
 17/50 | 14:48:48 | CREATE_IN_PROGRESS   | AWS::EC2::SecurityGroup                   | Ec2Service/LB/SecurityGroup (Ec2ServiceLBSecurityGroup45FED6DF) Resource creation Initiated
 18/50 | 14:48:50 | CREATE_COMPLETE      | AWS::EC2::SecurityGroup                   | Ec2Service/LB/SecurityGroup (Ec2ServiceLBSecurityGroup45FED6DF) 
 19/50 | 14:48:50 | CREATE_COMPLETE      | AWS::EC2::SecurityGroup                   | Ec2Cluster/DefaultAutoScalingGroup/InstanceSecurityGroup (Ec2ClusterDefaultAutoScalingGroupInstanceSecurityGroup149B0A9E) 
 19/50 | 14:48:53 | CREATE_IN_PROGRESS   | AWS::EC2::SecurityGroupIngress            | Ec2Cluster/DefaultAutoScalingGroup/InstanceSecurityGroup/from BonjourEc2ServiceLBSecurityGroup2185A60D:32768-65535 (Ec2ClusterDefaultAutoScalingGroupInstanceSecurityGroupfromBonjourEc2ServiceLBSecurityGroup2185A60D3276865535EC4EE766) 
 19/50 | 14:48:53 | CREATE_IN_PROGRESS   | AWS::EC2::SecurityGroupIngress            | Ec2Cluster/DefaultAutoScalingGroup/InstanceSecurityGroup/from BonjourEc2ServiceLBSecurityGroup2185A60D:32768-65535 (Ec2ClusterDefaultAutoScalingGroupInstanceSecurityGroupfromBonjourEc2ServiceLBSecurityGroup2185A60D3276865535EC4EE766) Resource creation Initiated
 19/50 | 14:48:53 | CREATE_IN_PROGRESS   | AWS::EC2::SecurityGroupEgress             | Ec2Service/LB/SecurityGroup/to BonjourEc2ClusterDefaultAutoScalingGroupInstanceSecurityGroupE49ADAF5:32768-65535 (Ec2ServiceLBSecurityGrouptoBonjourEc2ClusterDefaultAutoScalingGroupInstanceSecurityGroupE49ADAF53276865535AC4204BB) 
 20/50 | 14:48:54 | CREATE_COMPLETE      | AWS::IAM::Policy                          | Ec2Cluster/DefaultAutoScalingGroup/LifecycleHookDrainHook/Role/DefaultPolicy (Ec2ClusterDefaultAutoScalingGroupLifecycleHookDrainHookRoleDefaultPolicyE499974B) 
 20/50 | 14:48:54 | CREATE_IN_PROGRESS   | AWS::EC2::SecurityGroupEgress             | Ec2Service/LB/SecurityGroup/to BonjourEc2ClusterDefaultAutoScalingGroupInstanceSecurityGroupE49ADAF5:32768-65535 (Ec2ServiceLBSecurityGrouptoBonjourEc2ClusterDefaultAutoScalingGroupInstanceSecurityGroupE49ADAF53276865535AC4204BB) Resource creation Initiated
 21/50 | 14:48:54 | CREATE_COMPLETE      | AWS::IAM::Policy                          | Ec2Cluster/DefaultAutoScalingGroup/InstanceRole/DefaultPolicy (Ec2ClusterDefaultAutoScalingGroupInstanceRoleDefaultPolicy6D2DC2FD) 
 22/50 | 14:48:54 | CREATE_COMPLETE      | AWS::EC2::SecurityGroupIngress            | Ec2Cluster/DefaultAutoScalingGroup/InstanceSecurityGroup/from BonjourEc2ServiceLBSecurityGroup2185A60D:32768-65535 (Ec2ClusterDefaultAutoScalingGroupInstanceSecurityGroupfromBonjourEc2ServiceLBSecurityGroup2185A60D3276865535EC4EE766) 
 23/50 | 14:48:55 | CREATE_COMPLETE      | AWS::IAM::Policy                          | Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Function/ServiceRole/DefaultPolicy (Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionServiceRoleDefaultPolicy638C9E33) 
 24/50 | 14:48:56 | CREATE_COMPLETE      | AWS::EC2::SecurityGroupEgress             | Ec2Service/LB/SecurityGroup/to BonjourEc2ClusterDefaultAutoScalingGroupInstanceSecurityGroupE49ADAF5:32768-65535 (Ec2ServiceLBSecurityGrouptoBonjourEc2ClusterDefaultAutoScalingGroupInstanceSecurityGroupE49ADAF53276865535AC4204BB) 
 24/50 | 14:48:58 | CREATE_IN_PROGRESS   | AWS::Lambda::Function                     | Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Function (Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionE0DEFB31) 
 24/50 | 14:48:58 | CREATE_IN_PROGRESS   | AWS::Lambda::Function                     | Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Function (Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionE0DEFB31) Resource creation Initiated
 25/50 | 14:48:59 | CREATE_COMPLETE      | AWS::Lambda::Function                     | Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Function (Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionE0DEFB31) 
 26/50 | 14:48:59 | CREATE_COMPLETE      | AWS::EC2::VPCGatewayAttachment            | MyVpc/VPCGW (MyVpcVPCGW488ACE0D) 
 27/50 | 14:49:00 | CREATE_COMPLETE      | AWS::EC2::Subnet                          | MyVpc/PrivateSubnet1/Subnet (MyVpcPrivateSubnet1Subnet5057CF7E) 
 28/50 | 14:49:00 | CREATE_COMPLETE      | AWS::EC2::Subnet                          | MyVpc/PrivateSubnet2/Subnet (MyVpcPrivateSubnet2Subnet0040C983) 
 29/50 | 14:49:00 | CREATE_COMPLETE      | AWS::EC2::Subnet                          | MyVpc/PublicSubnet1/Subnet (MyVpcPublicSubnet1SubnetF6608456) 
 30/50 | 14:49:00 | CREATE_COMPLETE      | AWS::EC2::Subnet                          | MyVpc/PublicSubnet2/Subnet (MyVpcPublicSubnet2Subnet492B6BFB) 
 30/50 | 14:49:02 | CREATE_IN_PROGRESS   | AWS::SNS::Subscription                    | Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Topic/FunctionSubscription (Ec2ClusterDefaultAutoScalingGroupDrainECSHookTopicFunctionSubscription5FABD83E) 
 30/50 | 14:49:02 | CREATE_IN_PROGRESS   | AWS::EC2::Route                           | MyVpc/PublicSubnet2/DefaultRoute (MyVpcPublicSubnet2DefaultRoute052936F6) 
 30/50 | 14:49:02 | CREATE_IN_PROGRESS   | AWS::Lambda::Permission                   | Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Function/Topic (Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionTopic6C30136B) 
 30/50 | 14:49:03 | CREATE_IN_PROGRESS   | AWS::Lambda::Permission                   | Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Function/Topic (Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionTopic6C30136B) Resource creation Initiated
 30/50 | 14:49:03 | CREATE_IN_PROGRESS   | AWS::EC2::Route                           | MyVpc/PublicSubnet2/DefaultRoute (MyVpcPublicSubnet2DefaultRoute052936F6) Resource creation Initiated
 30/50 | 14:49:03 | CREATE_IN_PROGRESS   | AWS::EC2::Route                           | MyVpc/PublicSubnet1/DefaultRoute (MyVpcPublicSubnet1DefaultRoute95FDF9EB) 
 30/50 | 14:49:03 | CREATE_IN_PROGRESS   | AWS::SNS::Subscription                    | Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Topic/FunctionSubscription (Ec2ClusterDefaultAutoScalingGroupDrainECSHookTopicFunctionSubscription5FABD83E) Resource creation Initiated
 31/50 | 14:49:03 | CREATE_COMPLETE      | AWS::SNS::Subscription                    | Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Topic/FunctionSubscription (Ec2ClusterDefaultAutoScalingGroupDrainECSHookTopicFunctionSubscription5FABD83E) 
 31/50 | 14:49:03 | CREATE_IN_PROGRESS   | AWS::EC2::SubnetRouteTableAssociation     | MyVpc/PublicSubnet1/RouteTableAssociation (MyVpcPublicSubnet1RouteTableAssociation2ECEE1CB) 
 31/50 | 14:49:04 | CREATE_IN_PROGRESS   | AWS::EC2::SubnetRouteTableAssociation     | MyVpc/PublicSubnet2/RouteTableAssociation (MyVpcPublicSubnet2RouteTableAssociation227DE78D) 
 31/50 | 14:49:04 | CREATE_IN_PROGRESS   | AWS::EC2::NatGateway                      | MyVpc/PublicSubnet1/NATGateway (MyVpcPublicSubnet1NATGatewayAD3400C1) 
 31/50 | 14:49:04 | CREATE_IN_PROGRESS   | AWS::EC2::Route                           | MyVpc/PublicSubnet1/DefaultRoute (MyVpcPublicSubnet1DefaultRoute95FDF9EB) Resource creation Initiated
 31/50 | 14:49:04 | CREATE_IN_PROGRESS   | AWS::EC2::SubnetRouteTableAssociation     | MyVpc/PrivateSubnet2/RouteTableAssociation (MyVpcPrivateSubnet2RouteTableAssociation86A610DA) 
 31/50 | 14:49:04 | CREATE_IN_PROGRESS   | AWS::EC2::SubnetRouteTableAssociation     | MyVpc/PrivateSubnet1/RouteTableAssociation (MyVpcPrivateSubnet1RouteTableAssociation56D38C7E) 
 31/50 | 14:49:04 | CREATE_IN_PROGRESS   | AWS::EC2::NatGateway                      | MyVpc/PublicSubnet2/NATGateway (MyVpcPublicSubnet2NATGateway91BFBEC9) 
 31/50 | 14:49:04 | CREATE_IN_PROGRESS   | AWS::EC2::NatGateway                      | MyVpc/PublicSubnet1/NATGateway (MyVpcPublicSubnet1NATGatewayAD3400C1) Resource creation Initiated
 31/50 | 14:49:04 | CREATE_IN_PROGRESS   | AWS::ElasticLoadBalancingV2::LoadBalancer | Ec2Service/LB (Ec2ServiceLB381329CE) 
 31/50 | 14:49:05 | CREATE_IN_PROGRESS   | AWS::EC2::SubnetRouteTableAssociation     | MyVpc/PublicSubnet1/RouteTableAssociation (MyVpcPublicSubnet1RouteTableAssociation2ECEE1CB) Resource creation Initiated
 31/50 | 14:49:05 | CREATE_IN_PROGRESS   | AWS::EC2::NatGateway                      | MyVpc/PublicSubnet2/NATGateway (MyVpcPublicSubnet2NATGateway91BFBEC9) Resource creation Initiated
 31/50 | 14:49:05 | CREATE_IN_PROGRESS   | AWS::EC2::SubnetRouteTableAssociation     | MyVpc/PrivateSubnet2/RouteTableAssociation (MyVpcPrivateSubnet2RouteTableAssociation86A610DA) Resource creation Initiated
 31/50 | 14:49:05 | CREATE_IN_PROGRESS   | AWS::EC2::SubnetRouteTableAssociation     | MyVpc/PublicSubnet2/RouteTableAssociation (MyVpcPublicSubnet2RouteTableAssociation227DE78D) Resource creation Initiated
 31/50 | 14:49:05 | CREATE_IN_PROGRESS   | AWS::EC2::SubnetRouteTableAssociation     | MyVpc/PrivateSubnet1/RouteTableAssociation (MyVpcPrivateSubnet1RouteTableAssociation56D38C7E) Resource creation Initiated
 31/50 | 14:49:06 | CREATE_IN_PROGRESS   | AWS::ElasticLoadBalancingV2::LoadBalancer | Ec2Service/LB (Ec2ServiceLB381329CE) Resource creation Initiated
 32/50 | 14:49:13 | CREATE_COMPLETE      | AWS::Lambda::Permission                   | Ec2Cluster/DefaultAutoScalingGroup/DrainECSHook/Function/Topic (Ec2ClusterDefaultAutoScalingGroupDrainECSHookFunctionTopic6C30136B) 
 33/50 | 14:49:18 | CREATE_COMPLETE      | AWS::EC2::Route                           | MyVpc/PublicSubnet2/DefaultRoute (MyVpcPublicSubnet2DefaultRoute052936F6) 
 34/50 | 14:49:19 | CREATE_COMPLETE      | AWS::EC2::Route                           | MyVpc/PublicSubnet1/DefaultRoute (MyVpcPublicSubnet1DefaultRoute95FDF9EB) 
 35/50 | 14:49:20 | CREATE_COMPLETE      | AWS::EC2::SubnetRouteTableAssociation     | MyVpc/PublicSubnet1/RouteTableAssociation (MyVpcPublicSubnet1RouteTableAssociation2ECEE1CB) 
 36/50 | 14:49:20 | CREATE_COMPLETE      | AWS::EC2::SubnetRouteTableAssociation     | MyVpc/PrivateSubnet2/RouteTableAssociation (MyVpcPrivateSubnet2RouteTableAssociation86A610DA) 
 37/50 | 14:49:20 | CREATE_COMPLETE      | AWS::EC2::SubnetRouteTableAssociation     | MyVpc/PublicSubnet2/RouteTableAssociation (MyVpcPublicSubnet2RouteTableAssociation227DE78D) 
 38/50 | 14:49:20 | CREATE_COMPLETE      | AWS::EC2::SubnetRouteTableAssociation     | MyVpc/PrivateSubnet1/RouteTableAssociation (MyVpcPrivateSubnet1RouteTableAssociation56D38C7E) 
38/50 Currently in progress: Ec2ClusterDefaultAutoScalingGroupInstanceProfileDB232471, MyVpcPublicSubnet1NATGatewayAD3400C1, MyVpcPublicSubnet2NATGateway91BFBEC9, Ec2ServiceLB381329CE
 39/50 | 14:50:38 | CREATE_COMPLETE      | AWS::EC2::NatGateway                      | MyVpc/PublicSubnet2/NATGateway (MyVpcPublicSubnet2NATGateway91BFBEC9) 
 39/50 | 14:50:41 | CREATE_IN_PROGRESS   | AWS::EC2::Route                           | MyVpc/PrivateSubnet2/DefaultRoute (MyVpcPrivateSubnet2DefaultRoute9CE96294) 
 39/50 | 14:50:42 | CREATE_IN_PROGRESS   | AWS::EC2::Route                           | MyVpc/PrivateSubnet2/DefaultRoute (MyVpcPrivateSubnet2DefaultRoute9CE96294) Resource creation Initiated
 40/50 | 14:50:47 | CREATE_COMPLETE      | AWS::IAM::InstanceProfile                 | Ec2Cluster/DefaultAutoScalingGroup/InstanceProfile (Ec2ClusterDefaultAutoScalingGroupInstanceProfileDB232471) 
 40/50 | 14:50:50 | CREATE_IN_PROGRESS   | AWS::AutoScaling::LaunchConfiguration     | Ec2Cluster/DefaultAutoScalingGroup/LaunchConfig (Ec2ClusterDefaultAutoScalingGroupLaunchConfig7B2FED3A) 
 40/50 | 14:50:51 | CREATE_IN_PROGRESS   | AWS::AutoScaling::LaunchConfiguration     | Ec2Cluster/DefaultAutoScalingGroup/LaunchConfig (Ec2ClusterDefaultAutoScalingGroupLaunchConfig7B2FED3A) Resource creation Initiated
 41/50 | 14:50:51 | CREATE_COMPLETE      | AWS::AutoScaling::LaunchConfiguration     | Ec2Cluster/DefaultAutoScalingGroup/LaunchConfig (Ec2ClusterDefaultAutoScalingGroupLaunchConfig7B2FED3A) 
 42/50 | 14:50:53 | CREATE_COMPLETE      | AWS::EC2::NatGateway                      | MyVpc/PublicSubnet1/NATGateway (MyVpcPublicSubnet1NATGatewayAD3400C1) 
 42/50 | 14:50:55 | CREATE_IN_PROGRESS   | AWS::AutoScaling::AutoScalingGroup        | Ec2Cluster/DefaultAutoScalingGroup/ASG (Ec2ClusterDefaultAutoScalingGroupASGC5A6D4C0) 
 42/50 | 14:50:56 | CREATE_IN_PROGRESS   | AWS::AutoScaling::AutoScalingGroup        | Ec2Cluster/DefaultAutoScalingGroup/ASG (Ec2ClusterDefaultAutoScalingGroupASGC5A6D4C0) Resource creation Initiated
 42/50 | 14:50:56 | CREATE_IN_PROGRESS   | AWS::EC2::Route                           | MyVpc/PrivateSubnet1/DefaultRoute (MyVpcPrivateSubnet1DefaultRouteA8CDE2FA) 
 42/50 | 14:50:57 | CREATE_IN_PROGRESS   | AWS::EC2::Route                           | MyVpc/PrivateSubnet1/DefaultRoute (MyVpcPrivateSubnet1DefaultRouteA8CDE2FA) Resource creation Initiated
 43/50 | 14:50:57 | CREATE_COMPLETE      | AWS::EC2::Route                           | MyVpc/PrivateSubnet2/DefaultRoute (MyVpcPrivateSubnet2DefaultRoute9CE96294) 
 44/50 | 14:51:07 | CREATE_COMPLETE      | AWS::ElasticLoadBalancingV2::LoadBalancer | Ec2Service/LB (Ec2ServiceLB381329CE) 
 44/50 | 14:51:11 | CREATE_IN_PROGRESS   | AWS::ElasticLoadBalancingV2::Listener     | Ec2Service/LB/PublicListener (Ec2ServiceLBPublicListenerA941070C) 
 44/50 | 14:51:11 | CREATE_IN_PROGRESS   | AWS::ElasticLoadBalancingV2::Listener     | Ec2Service/LB/PublicListener (Ec2ServiceLBPublicListenerA941070C) Resource creation Initiated
 45/50 | 14:51:11 | CREATE_COMPLETE      | AWS::ElasticLoadBalancingV2::Listener     | Ec2Service/LB/PublicListener (Ec2ServiceLBPublicListenerA941070C) 
 46/50 | 14:51:13 | CREATE_COMPLETE      | AWS::EC2::Route                           | MyVpc/PrivateSubnet1/DefaultRoute (MyVpcPrivateSubnet1DefaultRouteA8CDE2FA) 
 46/50 | 14:51:15 | CREATE_IN_PROGRESS   | AWS::ECS::Service                         | Ec2Service/Service/Service (Ec2Service398F0E46) 
 46/50 | 14:51:15 | CREATE_IN_PROGRESS   | AWS::ECS::Service                         | Ec2Service/Service/Service (Ec2Service398F0E46) Resource creation Initiated
46/50 Currently in progress: Ec2ClusterDefaultAutoScalingGroupASGC5A6D4C0, Ec2Service398F0E46
 47/50 | 14:51:49 | CREATE_COMPLETE      | AWS::AutoScaling::AutoScalingGroup        | Ec2Cluster/DefaultAutoScalingGroup/ASG (Ec2ClusterDefaultAutoScalingGroupASGC5A6D4C0) 
 47/50 | 14:51:54 | CREATE_IN_PROGRESS   | AWS::AutoScaling::LifecycleHook           | Ec2Cluster/DefaultAutoScalingGroup/LifecycleHookDrainHook (Ec2ClusterDefaultAutoScalingGroupLifecycleHookDrainHook5CB1467E) 
 47/50 | 14:51:55 | CREATE_IN_PROGRESS   | AWS::AutoScaling::LifecycleHook           | Ec2Cluster/DefaultAutoScalingGroup/LifecycleHookDrainHook (Ec2ClusterDefaultAutoScalingGroupLifecycleHookDrainHook5CB1467E) Resource creation Initiated
 48/50 | 14:51:55 | CREATE_COMPLETE      | AWS::AutoScaling::LifecycleHook           | Ec2Cluster/DefaultAutoScalingGroup/LifecycleHookDrainHook (Ec2ClusterDefaultAutoScalingGroupLifecycleHookDrainHook5CB1467E) 
 49/50 | 14:52:16 | CREATE_COMPLETE      | AWS::ECS::Service                         | Ec2Service/Service/Service (Ec2Service398F0E46) 
 50/50 | 14:52:19 | CREATE_COMPLETE      | AWS::CloudFormation::Stack                | Bonjour 

 ✅  Bonjour

Outputs:
Bonjour.Ec2ServiceLoadBalancerDNS6983C9B2 = Bonjo-Ec2Se-2SOLN6HBXNN6-1969303271.ap-northeast-1.elb.amazonaws.com
Bonjour.LoadBalancerDNS = Bonjo-Ec2Se-2SOLN6HBXNN6-1969303271.ap-northeast-1.elb.amazonaws.com

Stack ARN:
arn:aws:cloudformation:ap-northeast-1:******:stack/Bonjour/4e064220-eee3-11e8-a113-0e89097244e0
```

![image.png](https://qiita-image-store.s3.amazonaws.com/0/78184/dfb8814b-d4d0-2edb-57bc-9790ffb9dfd2.png)

##約束

投稿内容は私個人の意見であり、所属企業・部門見解を代表するものではありません。