From 9a26f010ebc495dda0b6a77b78e2b74309305903 Mon Sep 17 00:00:00 2001 From: "Chad Schmutzer (schmutze@)" Date: Sat, 20 Oct 2018 22:27:06 -0700 Subject: [PATCH] adding ec2 spot fleet multiple VPC example --- .../ec2-spot-analyze-costs.yaml | 100 ++++++ .../ec2-spot-fleet-multiple-vpcs-vpca.yaml | 150 +++++++++ .../ec2-spot-fleet-multiple-vpcs-vpcb.yaml | 185 +++++++++++ .../ec2-spot-fleet-multiple-vpcs-vpcc.yaml | 185 +++++++++++ .../ec2-spot-fleet-multiple-vpcs.yaml | 302 ++++++++++++++++++ 5 files changed, 922 insertions(+) create mode 100644 ec2-spot-analyze-costs/ec2-spot-analyze-costs.yaml create mode 100644 ec2-spot-fleet-multiple-vpcs/ec2-spot-fleet-multiple-vpcs-vpca.yaml create mode 100644 ec2-spot-fleet-multiple-vpcs/ec2-spot-fleet-multiple-vpcs-vpcb.yaml create mode 100644 ec2-spot-fleet-multiple-vpcs/ec2-spot-fleet-multiple-vpcs-vpcc.yaml create mode 100644 ec2-spot-fleet-multiple-vpcs/ec2-spot-fleet-multiple-vpcs.yaml diff --git a/ec2-spot-analyze-costs/ec2-spot-analyze-costs.yaml b/ec2-spot-analyze-costs/ec2-spot-analyze-costs.yaml new file mode 100644 index 0000000..d4068dc --- /dev/null +++ b/ec2-spot-analyze-costs/ec2-spot-analyze-costs.yaml @@ -0,0 +1,100 @@ +--- +AWSTemplateFormatVersion: 2010-09-09 +Description: Example of how to analyze EC2 Spot Instance costs +Metadata: + Author: + Description: Chad Schmutzer + License: + Description: 'Copyright 2017 Amazon.com, Inc. and its affiliates. All Rights Reserved. + + Licensed under the Amazon Software License (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/asl/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" + BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under the License.' +Outputs: + awsRegionId: + Description: The AWS Region ID your template was launched in + Value: + Ref: AWS::Region +Parameters: + bucketPrefix: + Default: 123456789012 + Type: String +Resources: + lambdaExecutionRole: + Properties: + AssumeRolePolicyDocument: + Statement: + - Action: + - sts:AssumeRole + Effect: Allow + Principal: + Service: + - lambda.amazonaws.com + Version: '2012-10-17' + Path: / + Policies: + - PolicyDocument: + Statement: + - Action: + - logs:* + Effect: Allow + Resource: arn:aws:logs:*:*:* + Version: '2012-10-17' + PolicyName: root + Type: AWS::IAM::Role + lambdaFunction: + Properties: + Code: + ZipFile: + Fn::Sub: | + import boto3 + def handler(event, context): + print(event) + return + Handler: index.handler + Role: + Fn::GetAtt: + - lambdaExecutionRole + - Arn + Runtime: python3.6 + Type: AWS::Lambda::Function + lambdaInvokePermission: + Properties: + Action: lambda:InvokeFunction + FunctionName: + Fn::GetAtt: + - lambdaFunction + - Arn + Principal: s3.amazonaws.com + SourceAccount: + Ref: AWS::AccountId + SourceArn: + Fn::Join: + - '' + - - 'arn:aws:s3:::' + - Fn::Sub: ${bucketPrefix}-spot-instance-data-feed + Type: AWS::Lambda::Permission + s3Bucket: + DependsOn: lambdaInvokePermission + Properties: + BucketName: + Fn::Sub: ${bucketPrefix}-spot-instance-data-feed + NotificationConfiguration: + LambdaConfigurations: + - Event: s3:ObjectCreated:* + Filter: + S3Key: + Rules: + - Name: suffix + Value: gz + Function: + Fn::GetAtt: + - lambdaFunction + - Arn + Type: AWS::S3::Bucket +... diff --git a/ec2-spot-fleet-multiple-vpcs/ec2-spot-fleet-multiple-vpcs-vpca.yaml b/ec2-spot-fleet-multiple-vpcs/ec2-spot-fleet-multiple-vpcs-vpca.yaml new file mode 100644 index 0000000..f3c57d5 --- /dev/null +++ b/ec2-spot-fleet-multiple-vpcs/ec2-spot-fleet-multiple-vpcs-vpca.yaml @@ -0,0 +1,150 @@ +--- +AWSTemplateFormatVersion: 2010-09-09 +Description: Example of EC2 Spot Fleet using multiple VPCs with hub and spoke configuration + (VPC A) +Mappings: + CidrMappings: + vpcA: + CIDR: 172.16.0.0/16 + vpcAPublicSubnet1: + CIDR: 172.16.0.0/19 + vpcAPublicSubnet2: + CIDR: 172.16.32.0/19 +Metadata: + Author: + Description: Chad Schmutzer + License: + Description: 'Copyright 2017 Amazon.com, Inc. and its affiliates. All Rights Reserved. + + Licensed under the Amazon Software License (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/asl/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" + BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under the License.' +Outputs: + vpcA: + Value: + Ref: vpcA + vpcAPublicSubnet1: + Value: + Ref: vpcAPublicSubnet1 + vpcAPublicSubnet2: + Value: + Ref: vpcAPublicSubnet2 +Resources: + vpcA: + Properties: + CidrBlock: + Fn::FindInMap: + - CidrMappings + - vpcA + - CIDR + EnableDnsHostnames: true + EnableDnsSupport: true + Tags: + - Key: Name + Value: VPC A + Type: AWS::EC2::VPC + vpcAAttachGateway: + DependsOn: + - vpcA + - vpcAInternetGateway + Properties: + InternetGatewayId: + Ref: vpcAInternetGateway + VpcId: + Ref: vpcA + Type: AWS::EC2::VPCGatewayAttachment + vpcAInternetGateway: + DependsOn: + - vpcA + Type: AWS::EC2::InternetGateway + vpcAPublicRoute: + DependsOn: + - vpcAPublicRouteTable + - vpcAInternetGateway + - vpcAAttachGateway + Properties: + DestinationCidrBlock: 0.0.0.0/0 + GatewayId: + Ref: vpcAInternetGateway + RouteTableId: + Ref: vpcAPublicRouteTable + Type: AWS::EC2::Route + vpcAPublicRouteTable: + DependsOn: + - vpcA + - vpcAAttachGateway + Properties: + Tags: + - Key: Name + Value: VPC A Public Route Table + VpcId: + Ref: vpcA + Type: AWS::EC2::RouteTable + vpcAPublicSubnet1: + DependsOn: vpcAAttachGateway + Properties: + AvailabilityZone: + Fn::Select: + - 0 + - Fn::GetAZs: + Ref: AWS::Region + CidrBlock: + Fn::FindInMap: + - CidrMappings + - vpcAPublicSubnet1 + - CIDR + MapPublicIpOnLaunch: true + Tags: + - Key: Name + Value: VPC A Public Subnet 1 + VpcId: + Ref: vpcA + Type: AWS::EC2::Subnet + vpcAPublicSubnet1RouteTableAssociation: + DependsOn: + - vpcAPublicRouteTable + - vpcAPublicSubnet1 + - vpcAAttachGateway + Properties: + RouteTableId: + Ref: vpcAPublicRouteTable + SubnetId: + Ref: vpcAPublicSubnet1 + Type: AWS::EC2::SubnetRouteTableAssociation + vpcAPublicSubnet2: + DependsOn: vpcAAttachGateway + Properties: + AvailabilityZone: + Fn::Select: + - 1 + - Fn::GetAZs: + Ref: AWS::Region + CidrBlock: + Fn::FindInMap: + - CidrMappings + - vpcAPublicSubnet2 + - CIDR + MapPublicIpOnLaunch: true + Tags: + - Key: Name + Value: VPC A Public Subnet 2 + VpcId: + Ref: vpcA + Type: AWS::EC2::Subnet + vpcAPublicSubnet2RouteTableAssociation: + DependsOn: + - vpcAPublicRouteTable + - vpcAPublicSubnet2 + - vpcAAttachGateway + Properties: + RouteTableId: + Ref: vpcAPublicRouteTable + SubnetId: + Ref: vpcAPublicSubnet2 + Type: AWS::EC2::SubnetRouteTableAssociation +... diff --git a/ec2-spot-fleet-multiple-vpcs/ec2-spot-fleet-multiple-vpcs-vpcb.yaml b/ec2-spot-fleet-multiple-vpcs/ec2-spot-fleet-multiple-vpcs-vpcb.yaml new file mode 100644 index 0000000..357c308 --- /dev/null +++ b/ec2-spot-fleet-multiple-vpcs/ec2-spot-fleet-multiple-vpcs-vpcb.yaml @@ -0,0 +1,185 @@ +--- +AWSTemplateFormatVersion: 2010-09-09 +Description: Example of EC2 Spot Fleet using multiple VPCs with hub and spoke configuration + (VPC B) +Mappings: + CidrMappings: + vpcB: + CIDR: 10.0.0.0/16 + vpcBPrivateSubnet0: + CIDR: 10.0.0.0/19 + vpcBPrivateSubnet1: + CIDR: 10.0.32.0/19 + vpcBPrivateSubnet2: + CIDR: 10.0.64.0/19 + vpcBPrivateSubnet3: + CIDR: 10.0.96.0/19 + vpcBPrivateSubnet4: + CIDR: 10.0.128.0/19 + vpcBPrivateSubnet5: + CIDR: 10.0.160.0/19 +Metadata: + Author: + Description: Chad Schmutzer + License: + Description: 'Copyright 2017 Amazon.com, Inc. and its affiliates. All Rights Reserved. + + Licensed under the Amazon Software License (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/asl/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" + BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under the License.' +Outputs: + vpcB: + Value: + Ref: vpcB + vpcBPrivateSubnet0: + Value: + Ref: vpcBPrivateSubnet0 + vpcBPrivateSubnet1: + Value: + Ref: vpcBPrivateSubnet1 + vpcBPrivateSubnet2: + Value: + Ref: vpcBPrivateSubnet2 + vpcBPrivateSubnet3: + Value: + Ref: vpcBPrivateSubnet3 + vpcBPrivateSubnet4: + Value: + Ref: vpcBPrivateSubnet4 + vpcBPrivateSubnet5: + Value: + Ref: vpcBPrivateSubnet5 +Resources: + vpcB: + Properties: + CidrBlock: + Fn::FindInMap: + - CidrMappings + - vpcB + - CIDR + EnableDnsHostnames: true + EnableDnsSupport: true + Tags: + - Key: Name + Value: VPC B + Type: AWS::EC2::VPC + vpcBPrivateSubnet0: + Properties: + AvailabilityZone: + Fn::Select: + - 0 + - Fn::GetAZs: + Ref: AWS::Region + CidrBlock: + Fn::FindInMap: + - CidrMappings + - vpcBPrivateSubnet0 + - CIDR + MapPublicIpOnLaunch: false + Tags: + - Key: Name + Value: VPC B Private Subnet 0 + VpcId: + Ref: vpcB + Type: AWS::EC2::Subnet + vpcBPrivateSubnet1: + Properties: + AvailabilityZone: + Fn::Select: + - 1 + - Fn::GetAZs: + Ref: AWS::Region + CidrBlock: + Fn::FindInMap: + - CidrMappings + - vpcBPrivateSubnet1 + - CIDR + MapPublicIpOnLaunch: false + Tags: + - Key: Name + Value: VPC B Private Subnet 1 + VpcId: + Ref: vpcB + Type: AWS::EC2::Subnet + vpcBPrivateSubnet2: + Properties: + AvailabilityZone: + Fn::Select: + - 2 + - Fn::GetAZs: + Ref: AWS::Region + CidrBlock: + Fn::FindInMap: + - CidrMappings + - vpcBPrivateSubnet2 + - CIDR + MapPublicIpOnLaunch: false + Tags: + - Key: Name + Value: VPC B Private Subnet 2 + VpcId: + Ref: vpcB + Type: AWS::EC2::Subnet + vpcBPrivateSubnet3: + Properties: + AvailabilityZone: + Fn::Select: + - 3 + - Fn::GetAZs: + Ref: AWS::Region + CidrBlock: + Fn::FindInMap: + - CidrMappings + - vpcBPrivateSubnet3 + - CIDR + MapPublicIpOnLaunch: false + Tags: + - Key: Name + Value: VPC B Private Subnet 3 + VpcId: + Ref: vpcB + Type: AWS::EC2::Subnet + vpcBPrivateSubnet4: + Properties: + AvailabilityZone: + Fn::Select: + - 4 + - Fn::GetAZs: + Ref: AWS::Region + CidrBlock: + Fn::FindInMap: + - CidrMappings + - vpcBPrivateSubnet4 + - CIDR + MapPublicIpOnLaunch: false + Tags: + - Key: Name + Value: VPC B Private Subnet 4 + VpcId: + Ref: vpcB + Type: AWS::EC2::Subnet + vpcBPrivateSubnet5: + Properties: + AvailabilityZone: + Fn::Select: + - 5 + - Fn::GetAZs: + Ref: AWS::Region + CidrBlock: + Fn::FindInMap: + - CidrMappings + - vpcBPrivateSubnet5 + - CIDR + MapPublicIpOnLaunch: false + Tags: + - Key: Name + Value: VPC B Private Subnet 5 + VpcId: + Ref: vpcB + Type: AWS::EC2::Subnet +... diff --git a/ec2-spot-fleet-multiple-vpcs/ec2-spot-fleet-multiple-vpcs-vpcc.yaml b/ec2-spot-fleet-multiple-vpcs/ec2-spot-fleet-multiple-vpcs-vpcc.yaml new file mode 100644 index 0000000..36ea726 --- /dev/null +++ b/ec2-spot-fleet-multiple-vpcs/ec2-spot-fleet-multiple-vpcs-vpcc.yaml @@ -0,0 +1,185 @@ +--- +AWSTemplateFormatVersion: 2010-09-09 +Description: Example of EC2 Spot Fleet using multiple VPCs with hub and spoke configuration + (VPC C) +Mappings: + CidrMappings: + vpcC: + CIDR: 10.1.0.0/16 + vpcCPrivateSubnet0: + CIDR: 10.1.0.0/19 + vpcCPrivateSubnet1: + CIDR: 10.1.32.0/19 + vpcCPrivateSubnet2: + CIDR: 10.1.64.0/19 + vpcCPrivateSubnet3: + CIDR: 10.1.96.0/19 + vpcCPrivateSubnet4: + CIDR: 10.1.128.0/19 + vpcCPrivateSubnet5: + CIDR: 10.1.160.0/19 +Metadata: + Author: + Description: Chad Schmutzer + License: + Description: 'Copyright 2017 Amazon.com, Inc. and its affiliates. All Rights Reserved. + + Licensed under the Amazon Software License (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/asl/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" + BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under the License.' +Outputs: + vpcC: + Value: + Ref: vpcC + vpcCPrivateSubnet0: + Value: + Ref: vpcCPrivateSubnet0 + vpcCPrivateSubnet1: + Value: + Ref: vpcCPrivateSubnet1 + vpcCPrivateSubnet2: + Value: + Ref: vpcCPrivateSubnet2 + vpcCPrivateSubnet3: + Value: + Ref: vpcCPrivateSubnet3 + vpcCPrivateSubnet4: + Value: + Ref: vpcCPrivateSubnet4 + vpcCPrivateSubnet5: + Value: + Ref: vpcCPrivateSubnet5 +Resources: + vpcC: + Properties: + CidrBlock: + Fn::FindInMap: + - CidrMappings + - vpcC + - CIDR + EnableDnsHostnames: true + EnableDnsSupport: true + Tags: + - Key: Name + Value: VPC C + Type: AWS::EC2::VPC + vpcCPrivateSubnet0: + Properties: + AvailabilityZone: + Fn::Select: + - 0 + - Fn::GetAZs: + Ref: AWS::Region + CidrBlock: + Fn::FindInMap: + - CidrMappings + - vpcCPrivateSubnet0 + - CIDR + MapPublicIpOnLaunch: false + Tags: + - Key: Name + Value: VPC B Private Subnet 0 + VpcId: + Ref: vpcC + Type: AWS::EC2::Subnet + vpcCPrivateSubnet1: + Properties: + AvailabilityZone: + Fn::Select: + - 1 + - Fn::GetAZs: + Ref: AWS::Region + CidrBlock: + Fn::FindInMap: + - CidrMappings + - vpcCPrivateSubnet1 + - CIDR + MapPublicIpOnLaunch: false + Tags: + - Key: Name + Value: VPC B Private Subnet 1 + VpcId: + Ref: vpcC + Type: AWS::EC2::Subnet + vpcCPrivateSubnet2: + Properties: + AvailabilityZone: + Fn::Select: + - 2 + - Fn::GetAZs: + Ref: AWS::Region + CidrBlock: + Fn::FindInMap: + - CidrMappings + - vpcCPrivateSubnet2 + - CIDR + MapPublicIpOnLaunch: false + Tags: + - Key: Name + Value: VPC B Private Subnet 2 + VpcId: + Ref: vpcC + Type: AWS::EC2::Subnet + vpcCPrivateSubnet3: + Properties: + AvailabilityZone: + Fn::Select: + - 3 + - Fn::GetAZs: + Ref: AWS::Region + CidrBlock: + Fn::FindInMap: + - CidrMappings + - vpcCPrivateSubnet3 + - CIDR + MapPublicIpOnLaunch: false + Tags: + - Key: Name + Value: VPC B Private Subnet 3 + VpcId: + Ref: vpcC + Type: AWS::EC2::Subnet + vpcCPrivateSubnet4: + Properties: + AvailabilityZone: + Fn::Select: + - 4 + - Fn::GetAZs: + Ref: AWS::Region + CidrBlock: + Fn::FindInMap: + - CidrMappings + - vpcCPrivateSubnet4 + - CIDR + MapPublicIpOnLaunch: false + Tags: + - Key: Name + Value: VPC B Private Subnet 4 + VpcId: + Ref: vpcC + Type: AWS::EC2::Subnet + vpcCPrivateSubnet5: + Properties: + AvailabilityZone: + Fn::Select: + - 5 + - Fn::GetAZs: + Ref: AWS::Region + CidrBlock: + Fn::FindInMap: + - CidrMappings + - vpcCPrivateSubnet5 + - CIDR + MapPublicIpOnLaunch: false + Tags: + - Key: Name + Value: VPC B Private Subnet 5 + VpcId: + Ref: vpcC + Type: AWS::EC2::Subnet +... diff --git a/ec2-spot-fleet-multiple-vpcs/ec2-spot-fleet-multiple-vpcs.yaml b/ec2-spot-fleet-multiple-vpcs/ec2-spot-fleet-multiple-vpcs.yaml new file mode 100644 index 0000000..8c4de38 --- /dev/null +++ b/ec2-spot-fleet-multiple-vpcs/ec2-spot-fleet-multiple-vpcs.yaml @@ -0,0 +1,302 @@ +--- +AWSTemplateFormatVersion: 2010-09-09 +Description: Example of EC2 Spot Fleet using multiple VPCs with hub and spoke configuration. + Fractional Instances Weights are being used such that 1 unit of target capacity = 100 vCPUs. +Mappings: + amazonLinuxAmi: + us-east-1: + AMI: ami-0922553b7b0369273 +Metadata: + Author: + Description: Chad Schmutzer + License: + Description: 'Copyright 2017 Amazon.com, Inc. and its affiliates. All Rights Reserved. + + Licensed under the Amazon Software License (the "License"). You may not use this file + except in compliance with the License. A copy of the License is located at + + http://aws.amazon.com/asl/ + + or in the "license" file accompanying this file. This file is distributed on an "AS IS" + BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under the License.' +Parameters: + keyName: + Description: Name of an existing EC2 KeyPair to enable SSH access to the EC2 Instances + Type: AWS::EC2::KeyPair::KeyName + spotFleetTargetCapacity: + Default: 1 + Description: Spot Fleet target capacity. Fractional Instances Weights are being used such + that 1 unit of target capacity = 100 vCPUs. + Type: Number +Resources: + launchTemplate: + Properties: + LaunchTemplateData: + ImageId: + Fn::FindInMap: + - amazonLinuxAmi + - Ref: AWS::Region + - AMI + Type: AWS::EC2::LaunchTemplate + spotFleet: + DependsOn: + - spotFleetRole + - launchTemplate + - vpcAStack + - vpcBStack + - vpcCStack + Properties: + SpotFleetRequestConfigData: + AllocationStrategy: diversified + IamFleetRole: + Fn::GetAtt: + - spotFleetRole + - Arn + LaunchTemplateConfigs: + - LaunchTemplateSpecification: + LaunchTemplateId: + Ref: launchTemplate + Version: 1 + Overrides: + - InstanceType: c3.large + SubnetId: + Fn::GetAtt: + - vpcBStack + - Outputs.vpcBPrivateSubnet0 + WeightedCapacity: 0.02 + - InstanceType: c3.large + SubnetId: + Fn::GetAtt: + - vpcBStack + - Outputs.vpcBPrivateSubnet1 + WeightedCapacity: 0.02 + - InstanceType: c3.large + SubnetId: + Fn::GetAtt: + - vpcBStack + - Outputs.vpcBPrivateSubnet2 + WeightedCapacity: 0.02 + - InstanceType: c3.large + SubnetId: + Fn::GetAtt: + - vpcBStack + - Outputs.vpcBPrivateSubnet3 + WeightedCapacity: 0.02 + - InstanceType: c3.large + SubnetId: + Fn::GetAtt: + - vpcBStack + - Outputs.vpcBPrivateSubnet4 + WeightedCapacity: 0.02 + - InstanceType: c3.large + SubnetId: + Fn::GetAtt: + - vpcBStack + - Outputs.vpcBPrivateSubnet5 + WeightedCapacity: 0.02 + - InstanceType: c3.xlarge + SubnetId: + Fn::GetAtt: + - vpcCStack + - Outputs.vpcCPrivateSubnet0 + WeightedCapacity: 0.04 + - InstanceType: c3.xlarge + SubnetId: + Fn::GetAtt: + - vpcCStack + - Outputs.vpcCPrivateSubnet1 + WeightedCapacity: 0.04 + - InstanceType: c3.xlarge + SubnetId: + Fn::GetAtt: + - vpcCStack + - Outputs.vpcCPrivateSubnet2 + WeightedCapacity: 0.04 + - InstanceType: c3.xlarge + SubnetId: + Fn::GetAtt: + - vpcCStack + - Outputs.vpcCPrivateSubnet3 + WeightedCapacity: 0.04 + - InstanceType: c3.xlarge + SubnetId: + Fn::GetAtt: + - vpcCStack + - Outputs.vpcCPrivateSubnet4 + WeightedCapacity: 0.04 + - InstanceType: c3.xlarge + SubnetId: + Fn::GetAtt: + - vpcCStack + - Outputs.vpcCPrivateSubnet5 + WeightedCapacity: 0.04 + - InstanceType: c3.2xlarge + SubnetId: + Fn::GetAtt: + - vpcBStack + - Outputs.vpcBPrivateSubnet0 + WeightedCapacity: 0.08 + - InstanceType: c3.2xlarge + SubnetId: + Fn::GetAtt: + - vpcBStack + - Outputs.vpcBPrivateSubnet1 + WeightedCapacity: 0.08 + - InstanceType: c3.2xlarge + SubnetId: + Fn::GetAtt: + - vpcBStack + - Outputs.vpcBPrivateSubnet2 + WeightedCapacity: 0.08 + - InstanceType: c3.2xlarge + SubnetId: + Fn::GetAtt: + - vpcBStack + - Outputs.vpcBPrivateSubnet3 + WeightedCapacity: 0.08 + - InstanceType: c3.2xlarge + SubnetId: + Fn::GetAtt: + - vpcBStack + - Outputs.vpcBPrivateSubnet4 + WeightedCapacity: 0.08 + - InstanceType: c3.2xlarge + SubnetId: + Fn::GetAtt: + - vpcBStack + - Outputs.vpcBPrivateSubnet5 + WeightedCapacity: 0.08 + - InstanceType: c3.4xlarge + SubnetId: + Fn::GetAtt: + - vpcCStack + - Outputs.vpcCPrivateSubnet0 + WeightedCapacity: 0.16 + - InstanceType: c3.4xlarge + SubnetId: + Fn::GetAtt: + - vpcCStack + - Outputs.vpcCPrivateSubnet1 + WeightedCapacity: 0.16 + - InstanceType: c3.4xlarge + SubnetId: + Fn::GetAtt: + - vpcCStack + - Outputs.vpcCPrivateSubnet2 + WeightedCapacity: 0.16 + - InstanceType: c3.4xlarge + SubnetId: + Fn::GetAtt: + - vpcCStack + - Outputs.vpcCPrivateSubnet3 + WeightedCapacity: 0.16 + - InstanceType: c3.4xlarge + SubnetId: + Fn::GetAtt: + - vpcCStack + - Outputs.vpcCPrivateSubnet4 + WeightedCapacity: 0.16 + - InstanceType: c3.4xlarge + SubnetId: + Fn::GetAtt: + - vpcCStack + - Outputs.vpcCPrivateSubnet5 + WeightedCapacity: 0.16 + - InstanceType: c3.8xlarge + SubnetId: + Fn::GetAtt: + - vpcBStack + - Outputs.vpcBPrivateSubnet0 + WeightedCapacity: 0.32 + - InstanceType: c3.8xlarge + SubnetId: + Fn::GetAtt: + - vpcBStack + - Outputs.vpcBPrivateSubnet1 + WeightedCapacity: 0.32 + - InstanceType: c3.8xlarge + SubnetId: + Fn::GetAtt: + - vpcBStack + - Outputs.vpcBPrivateSubnet2 + WeightedCapacity: 0.32 + - InstanceType: c3.8xlarge + SubnetId: + Fn::GetAtt: + - vpcBStack + - Outputs.vpcBPrivateSubnet3 + WeightedCapacity: 0.32 + - InstanceType: c3.8xlarge + SubnetId: + Fn::GetAtt: + - vpcBStack + - Outputs.vpcBPrivateSubnet4 + WeightedCapacity: 0.32 + - InstanceType: c3.8xlarge + SubnetId: + Fn::GetAtt: + - vpcBStack + - Outputs.vpcBPrivateSubnet5 + WeightedCapacity: 0.32 + ReplaceUnhealthyInstances: true + TargetCapacity: + Ref: spotFleetTargetCapacity + TerminateInstancesWithExpiration: true + Type: AWS::EC2::SpotFleet + spotFleetRole: + Properties: + AssumeRolePolicyDocument: + Statement: + - Action: + - sts:AssumeRole + Effect: Allow + Principal: + Service: + - spotfleet.amazonaws.com + Version: 2012-10-17 + ManagedPolicyArns: + - arn:aws:iam::aws:policy/service-role/AmazonEC2SpotFleetTaggingRole + Path: / + Type: AWS::IAM::Role + vpcAPeeringB: + DependsOn: + - vpcAStack + - vpcBStack + Properties: + PeerVpcId: + Fn::GetAtt: + - vpcBStack + - Outputs.vpcB + VpcId: + Fn::GetAtt: + - vpcAStack + - Outputs.vpcA + Type: AWS::EC2::VPCPeeringConnection + vpcAPeeringC: + DependsOn: + - vpcAStack + - vpcCStack + Properties: + PeerVpcId: + Fn::GetAtt: + - vpcCStack + - Outputs.vpcC + VpcId: + Fn::GetAtt: + - vpcAStack + - Outputs.vpcA + Type: AWS::EC2::VPCPeeringConnection + vpcAStack: + Properties: + TemplateURL: https://s3.amazonaws.com/{MYBUCKET}/ec2-spot-fleet-multiple-vpcs-vpca.yaml + Type: AWS::CloudFormation::Stack + vpcBStack: + Properties: + TemplateURL: https://s3.amazonaws.com/{MYBUCKET}/ec2-spot-fleet-multiple-vpcs-vpcb.yaml + Type: AWS::CloudFormation::Stack + vpcCStack: + Properties: + TemplateURL: https://s3.amazonaws.com/{MYBUCKET}/ec2-spot-fleet-multiple-vpcs-vpcc.yaml + Type: AWS::CloudFormation::Stack +...