aws-compute-optimizer/aws-compute-optimizer.yaml [307:450]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            Effect: Allow
            Resource: '*'
          Version: '2012-10-17'
        PolicyName:
          Fn::Join:
          - '-'
          - - Ref: AWS::StackName
            - lambdaFunctionRole
    Type: AWS::IAM::Role
  launchTemplate:
    DependsOn:
    - instanceProfile
    - cloudWatchLogsGroup
    Properties:
      LaunchTemplateData:
        IamInstanceProfile:
          Arn:
            Fn::GetAtt:
            - instanceProfile
            - Arn
        ImageId:
          Fn::FindInMap:
          - amazonLinuxAmi
          - Ref: AWS::Region
          - AMI
        InstanceType:
          Ref: instanceType
        TagSpecifications:
        - ResourceType: instance
          Tags:
          - Key: Name
            Value:
              Ref: AWS::StackName
        UserData:
          Fn::Base64:
            Fn::Sub: '#!/bin/bash -xe

              yum -y install git

              cd /root && git clone https://github.com/awslabs/ec2-spot-labs.git

              REGION=${AWS::Region} CLOUDWATCHLOGSGROUP=${cloudWatchLogsGroup} bash /root/ec2-spot-labs/aws-compute-optimizer/user-data.sh

              '
    Type: AWS::EC2::LaunchTemplate
  publicRoute:
    DependsOn:
    - publicRouteTable
    - internetGateway
    - attachGateway
    Properties:
      DestinationCidrBlock: 0.0.0.0/0
      GatewayId:
        Ref: internetGateway
      RouteTableId:
        Ref: publicRouteTable
    Type: AWS::EC2::Route
  publicRouteTable:
    DependsOn:
    - vpc
    - attachGateway
    Properties:
      Tags:
      - Key: Name
        Value: Public Route Table
      VpcId:
        Ref: vpc
    Type: AWS::EC2::RouteTable
  publicSubnet1:
    DependsOn:
    - attachGateway
    Properties:
      AvailabilityZone:
        Fn::Select:
        - 0
        - Fn::GetAZs:
            Ref: AWS::Region
      CidrBlock:
        Fn::Select:
        - 0
        - Fn::Cidr:
          - Fn::FindInMap:
            - CidrMappings
            - vpc
            - CIDR
          - 256
          - 8
      MapPublicIpOnLaunch: true
      Tags:
      - Key: Name
        Value:
          Ref: AWS::StackName
      VpcId:
        Ref: vpc
    Type: AWS::EC2::Subnet
  publicSubnet1RouteTableAssociation:
    DependsOn:
    - publicRouteTable
    - publicSubnet1
    - attachGateway
    Properties:
      RouteTableId:
        Ref: publicRouteTable
      SubnetId:
        Ref: publicSubnet1
    Type: AWS::EC2::SubnetRouteTableAssociation
  publicSubnet2:
    DependsOn:
    - attachGateway
    Properties:
      AvailabilityZone:
        Fn::Select:
        - 1
        - Fn::GetAZs:
            Ref: AWS::Region
      CidrBlock:
        Fn::Select:
        - 1
        - Fn::Cidr:
          - Fn::FindInMap:
            - CidrMappings
            - vpc
            - CIDR
          - 256
          - 8
      MapPublicIpOnLaunch: true
      Tags:
      - Key: Name
        Value:
          Ref: AWS::StackName
      VpcId:
        Ref: vpc
    Type: AWS::EC2::Subnet
  publicSubnet2RouteTableAssociation:
    DependsOn:
    - publicRouteTable
    - publicSubnet2
    - attachGateway
    Properties:
      RouteTableId:
        Ref: publicRouteTable
      SubnetId:
        Ref: publicSubnet2
    Type: AWS::EC2::SubnetRouteTableAssociation
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



aws-compute-optimizer/opt3.yaml [251:394]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            Effect: Allow
            Resource: '*'
          Version: '2012-10-17'
        PolicyName:
          Fn::Join:
          - '-'
          - - Ref: AWS::StackName
            - lambdaFunctionRole
    Type: AWS::IAM::Role
  launchTemplate:
    DependsOn:
    - instanceProfile
    - cloudWatchLogsGroup
    Properties:
      LaunchTemplateData:
        IamInstanceProfile:
          Arn:
            Fn::GetAtt:
            - instanceProfile
            - Arn
        ImageId:
          Fn::FindInMap:
          - amazonLinuxAmi
          - Ref: AWS::Region
          - AMI
        InstanceType:
          Ref: instanceType
        TagSpecifications:
        - ResourceType: instance
          Tags:
          - Key: Name
            Value:
              Ref: AWS::StackName
        UserData:
          Fn::Base64:
            Fn::Sub: '#!/bin/bash -xe

              yum -y install git

              cd /root && git clone https://github.com/awslabs/ec2-spot-labs.git

              REGION=${AWS::Region} CLOUDWATCHLOGSGROUP=${cloudWatchLogsGroup} bash /root/ec2-spot-labs/aws-compute-optimizer/user-data.sh

              '
    Type: AWS::EC2::LaunchTemplate
  publicRoute:
    DependsOn:
    - publicRouteTable
    - internetGateway
    - attachGateway
    Properties:
      DestinationCidrBlock: 0.0.0.0/0
      GatewayId:
        Ref: internetGateway
      RouteTableId:
        Ref: publicRouteTable
    Type: AWS::EC2::Route
  publicRouteTable:
    DependsOn:
    - vpc
    - attachGateway
    Properties:
      Tags:
      - Key: Name
        Value: Public Route Table
      VpcId:
        Ref: vpc
    Type: AWS::EC2::RouteTable
  publicSubnet1:
    DependsOn:
    - attachGateway
    Properties:
      AvailabilityZone:
        Fn::Select:
        - 0
        - Fn::GetAZs:
            Ref: AWS::Region
      CidrBlock:
        Fn::Select:
        - 0
        - Fn::Cidr:
          - Fn::FindInMap:
            - CidrMappings
            - vpc
            - CIDR
          - 256
          - 8
      MapPublicIpOnLaunch: true
      Tags:
      - Key: Name
        Value:
          Ref: AWS::StackName
      VpcId:
        Ref: vpc
    Type: AWS::EC2::Subnet
  publicSubnet1RouteTableAssociation:
    DependsOn:
    - publicRouteTable
    - publicSubnet1
    - attachGateway
    Properties:
      RouteTableId:
        Ref: publicRouteTable
      SubnetId:
        Ref: publicSubnet1
    Type: AWS::EC2::SubnetRouteTableAssociation
  publicSubnet2:
    DependsOn:
    - attachGateway
    Properties:
      AvailabilityZone:
        Fn::Select:
        - 1
        - Fn::GetAZs:
            Ref: AWS::Region
      CidrBlock:
        Fn::Select:
        - 1
        - Fn::Cidr:
          - Fn::FindInMap:
            - CidrMappings
            - vpc
            - CIDR
          - 256
          - 8
      MapPublicIpOnLaunch: true
      Tags:
      - Key: Name
        Value:
          Ref: AWS::StackName
      VpcId:
        Ref: vpc
    Type: AWS::EC2::Subnet
  publicSubnet2RouteTableAssociation:
    DependsOn:
    - publicRouteTable
    - publicSubnet2
    - attachGateway
    Properties:
      RouteTableId:
        Ref: publicRouteTable
      SubnetId:
        Ref: publicSubnet2
    Type: AWS::EC2::SubnetRouteTableAssociation
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



