AWSTemplateFormatVersion: 2010-09-09 Description: Workload Template using Sigv2 S3 URLS (qs-1qkt7uig1) Metadata: LICENSE: "Apache License, Version 2.0" AUTHOR: "Tony Bulding" EMAIL: "tbulding@amazon.com" AWS::CloudFormation::Interface: ParameterGroups: - Label: default: Simple test parameter Parameters: - SSMParameterValue - Label: default: The Stack Definition Parameters: - ChildTemplate - Label: default: S3 reference data Parameters: - BucketName - BucketPrefix - BucketRegion ParameterLabels: SSMParameterValue: default: Value from master template ChildTemplate: default: The Stack we are going to run BucketName: default: S3 bucket name BucketPrefix: default: S3 Key Prefix BucketRegion: default: S3 bucket region Parameters: SSMParameterValue: Description: The value we want to store in Systems Manager Parameter Store Type: String ChildTemplate: AllowedValues: - "PathStyle-1" - "PathStyle-2" - "VirtualHostedStyle-1" Default: "PathStyle-1" Description: This is the test template we wish to run. Type: String BucketName: AllowedPattern: "^[0-9a-zA-Z]+([0-9a-zA-Z-]*[0-9a-zA-Z])*$" ConstraintDescription: >- The bucket name can include numbers, lowercase letters, uppercase letters, and hyphens (-). It cannot start or end with a hyphen (-). Default: "mybucket" Description: >- S3 bucket name for the s3 assets. The bucket name can include numbers, lowercase letters, uppercase letters, and hyphens (-). It cannot start or end with a hyphen (-). Type: String BucketPrefix: AllowedPattern: "^[0-9a-zA-Z-/]*$" ConstraintDescription: The key prefix can include numbers, lowercase letters, uppercase letters, hyphens (-), and forward slash (/). Default: sigv2-to-sigv4/ Description: S3 key prefix for the s3 assets. The key prefix can include numbers, lowercase letters, uppercase letters, hyphens (-), and forward slash (/). Type: String BucketRegion: Default: "us-east-1" Description: "The AWS Region where the S3 bucket (BucketName) is hosted." Type: String Conditions: GovCloudCondition: !Equals - !Ref AWS::Region - us-gov-west-1 UsingDefaultBucket: !Equals [!Ref BucketName, "mybucket"] ChildTemplate1Condition: !Equals - !Ref ChildTemplate - "PathStyle-1" ChildTemplate2Condition: !Equals - !Ref ChildTemplate - "PathStyle-2" ChildTemplate3Condition: !Equals - !Ref ChildTemplate - "VirtualHostedStyle-1" Resources: PathStyleStack1: # Path-Style endpoint no region specified Condition: ChildTemplate1Condition Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub "https://s3.amazonaws.com/${BucketName}/${BucketPrefix}templates/template.yaml" Parameters: SSMParameterValue: !Ref "SSMParameterValue" PathStyleStack2: # Path-Style endpoint with specified region Condition: ChildTemplate2Condition Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub - "https://${S3Region}.amazonaws.com/${BucketName}/${BucketPrefix}templates/template.yaml" - S3Region: !If [GovCloudCondition, s3-us-gov-west-1, s3.us-west-2] Parameters: SSMParameterValue: !Ref "SSMParameterValue" VirtualHostedStyleStack3: # Virtual Hosted-Style Condition: ChildTemplate3Condition Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub - https://${BucketName}.s3.${S3Region}.${AWS::URLSuffix}/${BucketPrefix}templates/template.yaml - S3Region: !If [UsingDefaultBucket, !Ref "AWS::Region", !Ref BucketRegion] Parameters: SSMParameterValue: !Ref "SSMParameterValue"