--- AWSTemplateFormatVersion: 2010-09-09 Description: > This template deploys the Retail Demo Store. Conditions: CreateOpenSearchServiceLinkedRole: !Equals - !Ref CreateOpenSearchServiceLinkedRole - "Yes" Parameters: ResourceBucket: Type: String Description: S3Bucket Bucket where the Resources are stored (cloudformation, images, lambda code) ResourceBucketRelativePath: Type: String Description: S3Bucket Path where the Resources are stored (cloudformation, images, lambda code) (i.e. path/path2), can be empty if resources are at the root of the bucket. MUST contain trailing / SourceDeploymentType: Type: String Description: Retail Demo Store source deployment type AllowedValues: - "GitHub" - "CodeCommit" Default: "CodeCommit" CreateOpenSearchServiceLinkedRole: Type: String Description: Whether to create OpenSearch Service Linked Role AllowedValues: - "Yes" - "No" Default: "Yes" CleanupBucketLambdaArn: Type: String Description: Lambda Arn for cleanup function AmplitudeApiKey: Type: String Description: Amplitude API key for product analytics and A/B testing results (optional). NoEcho: true ParentStackName: Type: String Description: Parent stack name OptimizelySdkKey: Type: String Description: Optimizely SDK key for experimentation (optional). NoEcho: true SegmentWriteKey: Type: String Description: Segment source write key (optional). NoEcho: true mParticleOrgId: Type: String Description: mParticle Org Id NoEcho: true mParticleApiKey: Type: String Description: mParticle API Key. NoEcho: true mParticleSecretKey: Type: String Description: mParticle Secret Key. NoEcho: true mParticleS2SApiKey: Type: String Description: mParticle server to server API Key. NoEcho: true mParticleS2SSecretKey: Type: String Description: mParticle server to server Secret Key. NoEcho: true PinpointSMSLongCode: Type: String Description: Pinpoint SMS Long code. GoogleAnalyticsMeasurementId: Type: String Description: Google Analytics Measurement Id (optional) LocationResourcePrefix: Type: String Description: Prefix of Location Services resources to use GitHubUser: Type: String Description: Your GitHub username. GitHubBranch: Type: String Description: The GitHub branch used for deployment. FenixZipDetectUrl: Type: String Description: Fenix Commerce Zipcode Detect URL Default: "https://ipapi.co/json?key=cKGC3jQbSIoXYmI2KtXObugsKfosD9Yr0HnkHhPUu1SM2wQhE0" FenixTenantId: Type: String Description: Fenix Commerce Demo Env TenantID Default: "ec6ea3439489426ba09cf6c906ead8d5" NoEcho: true FenixEddEndpoint: Type: String Description: Fenix Commerce Estimated Delivery Date Endpoint URL Default: "https://awsretaildemo.delest.fenixcommerce.com/fenixdelest/api/v2/deliveryestimates" FenixMonetaryValue: Type: String Description: Fenix Commerce Default monetary value to control free shipping above $100 default for demo Default: 100 FenixEnabledPdp: Type: String Description: Fenix Commerce Flag to enable EDD on PDP AllowedValues: - "TRUE" - "FALSE" Default: "TRUE" FenixEnabledCart: Type: String Description: Fenix Commerce Flag to enable EDD on CART AllowedValues: - "TRUE" - "FALSE" Default: "TRUE" FenixEnabledCheckout: Type: String Description: Fenix Commerce Flag to enable EDD on checkout AllowedValues: - "TRUE" - "FALSE" Default: "TRUE" FenixXapiKey: Type: String Description: Fenix Commerce Demo Env x-api-key Default: "nr50Qdu7FM94n2X1GYuhA8cFzyvdYTJ5Qka4XMOd" NoEcho: true Resources: # Authentication Authentication: Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/base/authentication.yaml Parameters: AuthName: !Sub ${ParentStackName}-${AWS::Region} PinpointAppId: !GetAtt Pinpoint.Outputs.PinpointAppId LocationResourcePrefix: !Ref LocationResourcePrefix # Buckets Buckets: Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/base/buckets.yaml Parameters: CleanupBucketLambdaArn: !Ref CleanupBucketLambdaArn # Notebook Instance Notebook: Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/base/notebook.yaml Parameters: ResourceBucket: !Ref ResourceBucket ResourceBucketRelativePath: !Ref ResourceBucketRelativePath VpcId: !GetAtt VPC.Outputs.VpcId Subnets: !GetAtt VPC.Outputs.Subnets Subnet1: !GetAtt VPC.Outputs.Subnet1 Subnet2: !GetAtt VPC.Outputs.Subnet2 ExperimentStrategyTable: !GetAtt Tables.Outputs.ExperimentStrategyTable StackBucketName: !GetAtt Buckets.Outputs.StackBucketName Uid: !Sub ${ParentStackName}-${AWS::Region} UserPoolId: !GetAtt Authentication.Outputs.UserPoolId PinpointAppId: !GetAtt Pinpoint.Outputs.PinpointAppId GitHubUser: !Ref GitHubUser GitHubBranch: !Ref GitHubBranch EvidentlyProjectName: !GetAtt Evidently.Outputs.EvidentlyProjectName # Tables Tables: Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/base/tables.yaml # ServiceDiscovery ServiceDiscovery: Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/base/servicediscovery.yaml Parameters: VpcId: !GetAtt VPC.Outputs.VpcId # ECS Cluster ECSCluster: Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/base/ecs-cluster.yaml # VPC VPC: Type: AWS::CloudFormation::Stack DependsOn: OpenSearchRoleWaitCondition # Ensure role is fully consistent before network and ultimately ES domain is created Properties: TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/base/vpc.yaml Parameters: Name: !Ref AWS::StackName VpcCIDR: 10.215.0.0/16 Subnet1CIDR: 10.215.10.0/24 Subnet2CIDR: 10.215.20.0/24 PublicSubnet1CIDR: 10.215.30.0/24 PublicSubnet2CIDR: 10.215.40.0/24 # OpenSearch # Create role here rather than in OpenSearch nested template so role has time to become consistent OpenSearchServiceLinkedRole: Condition: CreateOpenSearchServiceLinkedRole Type: AWS::IAM::ServiceLinkedRole Properties: AWSServiceName: opensearchservice.amazonaws.com Description: "Role for OpenSearch to access resources in VPC" OpenSearchRoleWaitHandle: Condition: CreateOpenSearchServiceLinkedRole DependsOn: OpenSearchServiceLinkedRole Type: AWS::CloudFormation::WaitConditionHandle WaitHandle: Type: AWS::CloudFormation::WaitConditionHandle OpenSearchRoleWaitCondition: Type: AWS::CloudFormation::WaitCondition Properties: Handle: !If [ CreateOpenSearchServiceLinkedRole, !Ref OpenSearchRoleWaitHandle, !Ref WaitHandle, ] Timeout: "1" Count: 0 OpenSearch: Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/base/opensearch.yaml Parameters: VpcId: !GetAtt VPC.Outputs.VpcId Subnets: !GetAtt VPC.Outputs.Subnets Subnet1: !GetAtt VPC.Outputs.Subnet1 Subnet2: !GetAtt VPC.Outputs.Subnet2 # SSM Parameters SSMParameters: Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/base/ssm.yaml Parameters: StackBucketName: !GetAtt Buckets.Outputs.StackBucketName ExperimentStrategyTableName: !GetAtt Tables.Outputs.ExperimentStrategyTable AmplitudeApiKey: !Ref AmplitudeApiKey OptimizelySdkKey: !Ref OptimizelySdkKey SegmentWriteKey: !Ref SegmentWriteKey mParticleOrgId: !Ref mParticleOrgId mParticleApiKey: !Ref mParticleApiKey mParticleSecretKey: !Ref mParticleSecretKey mParticleS2SApiKey: !Ref mParticleS2SApiKey mParticleS2SSecretKey: !Ref mParticleS2SSecretKey PinpointSMSLongCode: !Ref PinpointSMSLongCode GoogleAnalyticsMeasurementId: !Ref GoogleAnalyticsMeasurementId # CodeCommit Repository CodeCommitRepository: Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/base/codecommit.yaml Parameters: ResourceBucket: !Ref ResourceBucket ResourceBucketRelativePath: !Ref ResourceBucketRelativePath SourceDeploymentType: !Ref SourceDeploymentType # Pinpoint Resources Pinpoint: Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/base/pinpoint.yaml # CloudFront CDN CloudFront: Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/base/cloudfront.yaml Parameters: CleanupBucketLambdaArn: !Ref CleanupBucketLambdaArn LoggingBucketName: !GetAtt Buckets.Outputs.LoggingBucketName # Personalize Resources Personalize: Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/base/personalize.yaml Parameters: ResourceBucket: !Ref ResourceBucket Uid: !Sub ${ParentStackName}-${AWS::Region} StackBucketName: !GetAtt Buckets.Outputs.StackBucketName # Evidently Evidently: Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/base/evidently.yaml Parameters: Uid: !Sub ${ParentStackName}-${AWS::Region} # Event-Driven Architecture EventDrivenArchitecture: Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/base/event-driven.yaml Parameters: Uid: !Sub ${ParentStackName}-${AWS::Region} Outputs: UserPoolId: Description: Authentication Cognito User Pool Id. Value: !GetAtt Authentication.Outputs.UserPoolId UserPoolClientId: Description: Authentication Cognito User Pool Client Id. Value: !GetAtt Authentication.Outputs.UserPoolClientId IdentityPoolId: Description: Authentication Cognito Identity Pool Id. Value: !GetAtt Authentication.Outputs.IdentityPoolId StackBucketName: Description: Stack Bucket Value: !GetAtt Buckets.Outputs.StackBucketName LoggingBucketName: Description: S3 Bucket For logging Value: !GetAtt Buckets.Outputs.LoggingBucketName NotebookInstanceId: Description: Notebook Instance Id. Value: !GetAtt Notebook.Outputs.NotebookInstanceId VpcId: Description: VPC Id. Value: !GetAtt VPC.Outputs.VpcId VpcCidr: Description: VPC CIDR block Value: !GetAtt VPC.Outputs.VpcCidr Subnets: Description: Service Subnets. Value: !GetAtt VPC.Outputs.Subnets Subnet1: Description: Service Subnet1. Value: !GetAtt VPC.Outputs.Subnet1 Subnet2: Description: Service Subnet2. Value: !GetAtt VPC.Outputs.Subnet2 PrivateVPCSecurityGroup: Description: Default security for Lambda VPC Value: !GetAtt VPC.Outputs.PrivateVPCSecurityGroup ClusterName: Description: ECS Cluster Name. Value: !GetAtt ECSCluster.Outputs.ClusterName ServiceDiscoveryNamespace: Description: Service Discovery Namespace. Value: !GetAtt ServiceDiscovery.Outputs.ServiceDiscoveryNamespace OpenSearchDomainEndpoint: Description: OpenSearch Domain Value: !GetAtt OpenSearch.Outputs.DomainEndpoint OpenSearchDomainArn: Description: OpenSearch Domain Value: !GetAtt OpenSearch.Outputs.DomainArn OpenSearchSecurityGroupId: Description: OpenSearch Security Group Id Value: !GetAtt OpenSearch.Outputs.SecurityGroupId PinpointAppId: Description: Pinpoint App Id Value: !GetAtt Pinpoint.Outputs.PinpointAppId PinpointSMSLongCode: Description: Pinpoint SMS Long code for two way SMS Value: !GetAtt SSMParameters.Outputs.ParameterPinpointSMSLongCode ProductsTable: Description: DynamoDB Table for Products Value: !GetAtt Tables.Outputs.ProductsTable CategoriesTable: Description: DynamoDB Table for Categories Value: !GetAtt Tables.Outputs.CategoriesTable ExperimentStrategyTable: Description: DynamoDB Table for Experiments Value: !GetAtt Tables.Outputs.ExperimentStrategyTable ParameterPersonalizeEventTrackerId: Description: Personalize Event Tracker ID Parameter Value: !GetAtt SSMParameters.Outputs.ParameterPersonalizeEventTrackerId ParameterAmplitudeApiKey: Description: Amplitude API key Parameter Value: !GetAtt SSMParameters.Outputs.ParameterAmplitudeApiKey ParameterOptimizelySdkKey: Description: Optimizely SDK key Parameter Value: !GetAtt SSMParameters.Outputs.ParameterOptimizelySdkKey ParameterIVSVideoChannelMap: Description: Retail Demo Store video file to IVS channel mapping parameter Value: !GetAtt SSMParameters.Outputs.ParameterIVSVideoChannelMap ParameterSegmentWriteKey: Description: Segment write key Parameter Value: !GetAtt SSMParameters.Outputs.ParameterSegmentWriteKey ParameterGoogleAnalyticsMeasurementId: Description: Google Analytics Measurement Id Parameter Value: !GetAtt SSMParameters.Outputs.ParameterGoogleAnalyticsMeasurementId WebUIBucketName: Description: S3 bucket for CloudFront distribution. Value: !GetAtt CloudFront.Outputs.WebUIBucketName WebUICDN: Description: CloudFront distribution ID for the Web UI CDN Value: !GetAtt CloudFront.Outputs.WebUICDN WebUICDNURL: Description: The URL for the web application Value: !GetAtt CloudFront.Outputs.WebUICDNURL PersonalizeRoleArn: Description: IAM Role ARN that provides Amazon Personalize access to the stack bucket Value: !GetAtt Personalize.Outputs.PersonalizeServiceRole SwaggerUIBucketName: Description: S3 bucket for CloudFront distribution to store Swagger UI assets. Value: !GetAtt CloudFront.Outputs.SwaggerUIBucketName SwaggerUICDN: Description: CloudFront distribution ID for the Swagger UI CDN Value: !GetAtt CloudFront.Outputs.SwaggerUICDN SwaggerUICDNURL: Description: The URL for the web application Value: !GetAtt CloudFront.Outputs.SwaggerUICDNURL EvidentlyProjectName: Description: Evidently project name Value: !GetAtt Evidently.Outputs.EvidentlyProjectName EventBusName: Description: EventBridge event bus name Value: !GetAtt EventDrivenArchitecture.Outputs.EventBusName