Conditions: IsFailoverRegion: !Not - !Equals - !Ref 'PrimaryRegionName' - !Ref 'AWS::Region' IsPrimaryRegion: !Equals - !Ref 'PrimaryRegionName' - !Ref 'AWS::Region' Metadata: AWS::CloudFormation::Interface: ParameterGroups: [] ParameterLabels: {} Comments: '' CreatedBy: Carter Meyers (AWS) Description: This application deploys a Global RDS Aurora cluster. LastUpdated: February 20, 2023 Version: v1.09 Outputs: ApiHostExport: Export: Name: !Join - '' - - !Ref 'MainStackName' - -ApiHost Value: !Join - '' - - !Join - '' - - '{{resolve:ssm:/' - !Ref 'MainStackName' - /ApiId}} - .execute-api. - !Ref 'AWS::Region' - .amazonaws.com/ - v1 CustomApiEndpointExport: Export: Name: !Join - '' - - !Ref 'MainStackName' - -CustomApiEndpoint Value: !Join - '' - - api. - !Ref 'PublicFqdn' DefaultApiEndpointExport: Export: Name: !Join - '' - - !Ref 'MainStackName' - -DefaultApiEndpoint Value: !GetAtt 'DomainName.RegionalDomainName' Parameters: CodeDownloadUrl: Default: https://codeload.github.com/aws-samples/amazon-aurora-postgresql-fast-failover-demo/zip/refs/heads/main Description: The URL from which the supporting codebase can be downloaded. This codebase is used to deploy the demo dashboard. Type: String DatabaseAdminPassword: Description: The password to be used for the RDS Aurora admin account. NoEcho: true Type: String DatabaseAdminUsername: Description: The username to be used for the RDS Aurora admin account. Type: String FailoverDatabaseSubnetZoneACidr: Default: 10.10.10.0/24 Description: The CIDR range you wish to use for your primary database subnet. Type: String FailoverDatabaseSubnetZoneBCidr: Default: 10.10.13.0/24 Description: The CIDR range you wish to use for your failover database subnet. Type: String FailoverPrivateSubnetZoneACidr: Default: 10.10.9.0/24 Description: The CIDR range you wish to use for your primary private subnet. Type: String FailoverPrivateSubnetZoneBCidr: Default: 10.10.12.0/24 Description: The CIDR range you wish to use for your failover private subnet. Type: String FailoverPublicSubnetZoneACidr: Default: 10.10.8.0/24 Description: The CIDR range you wish to use for your primary public subnet. Type: String FailoverPublicSubnetZoneBCidr: Default: 10.10.11.0/24 Description: The CIDR range you wish to use for your failover public subnet. Type: String FailoverRegionName: Default: us-east-2 Description: The name of the failover region (e.g., us-east-1). You may choose any AWS Region that supports the required services. The primary and failover regions must be different. Type: String FailoverVpcCidr: Default: 10.10.8.0/21 Description: The CIDR range you wish to use for your VPC. Type: String MainStackName: Type: String PrimaryDatabaseSubnetZoneACidr: Default: 10.10.2.0/24 Description: The CIDR range you wish to use for your primary database subnet. Type: String PrimaryDatabaseSubnetZoneBCidr: Default: 10.10.5.0/24 Description: The CIDR range you wish to use for your failover database subnet. Type: String PrimaryPrivateSubnetZoneACidr: Default: 10.10.1.0/24 Description: The CIDR range you wish to use for your primary private subnet. Type: String PrimaryPrivateSubnetZoneBCidr: Default: 10.10.4.0/24 Description: The CIDR range you wish to use for your failover private subnet. Type: String PrimaryPublicSubnetZoneACidr: Default: 10.10.0.0/24 Description: The CIDR range you wish to use for your primary public subnet. Type: String PrimaryPublicSubnetZoneBCidr: Default: 10.10.3.0/24 Description: The CIDR range you wish to use for your failover public subnet. Type: String PrimaryRegionName: Default: us-east-1 Description: The name of the primary region (e.g., us-east-1). You may choose any AWS Region that supports the required services. The primary and failover regions must be different. Type: String PrimaryVpcCidr: Default: 10.10.0.0/21 Description: The CIDR range you wish to use for your VPC. Type: String PrivateHostedZoneId: Type: String PublicFqdn: Description: >- The FQDN to be used by this application (e.g., multi-region-aurora.example.com). An Amazon ACM Certificate will be issued for this FQDN and attached to an Amazon ALB. This FQDN should NOT have a DNS record currently defined in the corresponding Route 53 Hosted Zone. Type: String PublicHostedZoneId: Description: The ID of the public Route 53 Hosted Zone corresponding to the public Service FQDN. Type: String Resources: BasePathMapping: DependsOn: - DomainName - Deployment - DeploymentStage Properties: DomainName: !Join - '' - - api. - !Ref 'PublicFqdn' RestApiId: !Join - '' - - '{{resolve:ssm:/' - !Ref 'MainStackName' - /ApiId}} Stage: v1 Type: AWS::ApiGateway::BasePathMapping Deployment: Properties: Description: Initial Deployment RestApiId: !Join - '' - - '{{resolve:ssm:/' - !Ref 'MainStackName' - /ApiId}} Type: AWS::ApiGateway::Deployment DeploymentStage: DependsOn: - Deployment Properties: DeploymentId: !Ref 'Deployment' MethodSettings: - CachingEnabled: false DataTraceEnabled: true HttpMethod: GET MetricsEnabled: true ResourcePath: /~1 ThrottlingBurstLimit: '5000' ThrottlingRateLimit: '10000' - CachingEnabled: false DataTraceEnabled: true HttpMethod: POST MetricsEnabled: true ResourcePath: /~1 ThrottlingBurstLimit: '5000' ThrottlingRateLimit: '10000' RestApiId: !Join - '' - - '{{resolve:ssm:/' - !Ref 'MainStackName' - /ApiId}} StageName: v1 Type: AWS::ApiGateway::Stage DnsRecord: DependsOn: - DomainName Properties: HostedZoneId: !Ref 'PublicHostedZoneId' RecordSets: - AliasTarget: DNSName: !GetAtt 'DomainName.RegionalDomainName' HostedZoneId: !GetAtt 'DomainName.RegionalHostedZoneId' Name: !Join - '' - - api. - !Ref 'PublicFqdn' Type: A Type: AWS::Route53::RecordSetGroup DomainName: DependsOn: - TlsCertificate Properties: DomainName: !Join - '' - - api. - !Ref 'PublicFqdn' EndpointConfiguration: Types: - REGIONAL RegionalCertificateArn: !Ref 'TlsCertificate' Type: AWS::ApiGateway::DomainName TlsCertificate: Properties: DomainName: !Join - '' - - api. - !Ref 'PublicFqdn' DomainValidationOptions: - DomainName: !Join - '' - - api. - !Ref 'PublicFqdn' HostedZoneId: !Ref 'PublicHostedZoneId' ValidationMethod: DNS Type: AWS::CertificateManager::Certificate