AWSTemplateFormatVersion: 2010-09-09 Description: CloudFormation template for Launching DMS Replicaion Instance and creating Aurora PostgreSQL Endponts . Metadata: LICENSE: Apache License Version 2.0 AWS::CloudFormation::Interface: ParameterGroups: - Label: default: Replication Instance details Parameters: - ReplInstanceType - Subnets - RepSecurityGroup - RepMultiAZ - RepAllocatedStorage - Label: default: Source Database details Parameters: - SrcDatabaseConnection - SrcEngineType - SrcDBUsername - SrcDBPassword - Label: default: Target Database details Parameters: - TgtDatabaseConnection - TgtEngineType - TgtDBUsername - TgtDBPassword Parameters: ReplInstanceType: Default: dms.t3.medium AllowedValues: - dms.t3.medium - dms.c4.2xlarge - dms.c4.4xlarge - dms.r4.2xlarge - dms.r4.4xlarge Description: The instance type to use for the replication instance. Type: String Subnets: Type: CommaDelimitedList Description: List of subnet IDs RepSecurityGroup: Type: AWS::EC2::SecurityGroup::Id Description: Security group in your VPC with ingress to your database & this security group. RepMultiAZ: AllowedValues: - true - false Type: String Default: false Description: Specifies MultiAZ setup for Replication Instance RepAllocatedStorage: Type: String Default: 100 Description: Allocated storage for Replication Instance AllowedPattern: "^[0-9]*$" SrcDatabaseConnection: Type: String Description: "Provide source database connection detail - format hostname:port/dbname" AllowedPattern: "^(([a-zA-Z0-9-\\.]*?):([0-9]+)/([a-zA-Z0-9]*))$" SrcEngineType: Type: String Description: Provide source database engine type Default: aurora-postgresql AllowedValues: - "postgres" - "aurora-postgresql" SrcDBUsername: Type: String Description: Database Username Default: pgadmin MinLength: 4 MaxLength: 64 SrcDBPassword: NoEcho: true Type: String Default: auradmin Description: Database Password MinLength: 4 MaxLength: 128 TgtDatabaseConnection: Type: String Description: "Provide Target database connection detail - format hostname:port/dbname" AllowedPattern: "^([a-zA-Z0-9-\\.]*?):([0-9]+)/([a-zA-Z0-9]*$)" TgtEngineType: Type: String Description: Provide target database engine type Default: aurora-postgresql AllowedValues: - "postgres" - "aurora-postgresql" TgtDBUsername: Type: String Default: pgadmin Description: Database Username MinLength: 4 MaxLength: 64 TgtDBPassword: NoEcho: true Default: auradmin Type: String Description: Database Password MinLength: 4 MaxLength: 128 Resources: ReplicationSubnetGroup: Type: AWS::DMS::ReplicationSubnetGroup Properties: ReplicationSubnetGroupDescription: DMS Subnet Group SubnetIds: !Ref Subnets DMSReplicationInstance: Type: "AWS::DMS::ReplicationInstance" Properties: AllocatedStorage: !Ref RepAllocatedStorage MultiAZ: !Ref RepMultiAZ PubliclyAccessible: false EngineVersion: "3.4.4" AutoMinorVersionUpgrade: false ReplicationSubnetGroupIdentifier: !Ref ReplicationSubnetGroup ReplicationInstanceClass: !Ref ReplInstanceType ReplicationInstanceIdentifier: !Join - '-' - - 'ReplicationInstance' - !Ref 'AWS::StackName' SrcDMSEndpoint: Type: AWS::DMS::Endpoint Properties: EndpointIdentifier: !Join - '-' - - 'pgSrcDB' - !Ref 'AWS::StackName' EndpointType: source EngineName: !Ref SrcEngineType ServerName: !Select [0, !Split [":", !Ref SrcDatabaseConnection]] DatabaseName: !Select [1, !Split ["/", !Ref SrcDatabaseConnection]] Port: !Select [1, !Split [":",!Select [0, !Split ["/", !Ref SrcDatabaseConnection]]]] Username: !Ref SrcDBUsername Password: !Ref SrcDBPassword TgtDMSEndpoint: Type: AWS::DMS::Endpoint Properties: EndpointIdentifier: !Join - '-' - - 'pgTgtDB' - !Ref 'AWS::StackName' EndpointType: target EngineName: !Ref TgtEngineType ExtraConnectionAttributes: "maxFileSize=1048576" ServerName: !Select [0, !Split [":",!Ref TgtDatabaseConnection]] DatabaseName: !Select [1, !Split ["/",!Ref TgtDatabaseConnection]] Port: !Select [1, !Split [":",!Select [0, !Split ["/", !Ref TgtDatabaseConnection]]]] Username: !Ref TgtDBUsername Password: !Ref TgtDBPassword Outputs: ReplicationInstanceArn: Description: Replication Instance Arn Value: !Ref DMSReplicationInstance SrcEndpointArn: Description: Source Database Endpoint Arn Value: !Ref SrcDMSEndpoint TgtEndpointArn: Description: Target Database Endpoint Arn Value: !Ref TgtDMSEndpoint