AWSTemplateFormatVersion: 2010-09-09 Description: CloudFormation template that will deploy DMS replication instance for upgrading RDS Oracle demo # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # Permission is hereby granted, free of charge, to any person obtaining a copy of this # software and associated documentation files (the "Software"), to deal in the Software # without restriction, including without limitation the rights to use, copy, modify, # merge, publish, distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, # INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A # PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Parameters: ReplInstanceType: Default: dms.t3.medium AllowedValues: - dms.t3.small - dms.t3.medium - dms.t3.large - 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" - "oracle" SrcDBUsername: Type: String Description: Database Username MinLength: 4 MaxLength: 64 SrcDBPassword: NoEcho: true Type: String 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" - "oracle" TgtDBUsername: Type: String Description: Database Username MinLength: 4 MaxLength: 64 TgtDBPassword: NoEcho: true Type: String Description: Database Password MinLength: 4 MaxLength: 128 Metadata: 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 Resources: ReplicationSubnetGroup: Type: AWS::DMS::ReplicationSubnetGroup Properties: ReplicationSubnetGroupDescription: DMS Subnet Group SubnetIds: !Ref Subnets DMSReplicationInstance: Type: AWS::DMS::ReplicationInstance Properties: AllocatedStorage: !Ref RepAllocatedStorage VpcSecurityGroupIds: - !Ref RepSecurityGroup MultiAZ: !Ref RepMultiAZ PubliclyAccessible: false EngineVersion: 3.4.3 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 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