AWSTemplateFormatVersion: 2010-09-09 Description: Creates resources for the Oracle to Amazon Aurora migration workshop Mappings: RegionMap: us-east-1: "HVM64": "ami-001997e49afbbeb82" us-west-2: "HVM64": "ami-081ad13c8a0be0e0b" Resources: VPC: Type: 'AWS::EC2::VPC' Properties: EnableDnsSupport: 'true' EnableDnsHostnames: 'true' CidrBlock: 10.0.0.0/16 Tags: - Key: Application Value: !Ref 'AWS::StackName' Subnet1: Type: 'AWS::EC2::Subnet' Properties: VpcId: !Ref VPC CidrBlock: 10.0.0.0/24 AvailabilityZone: !Select [0, !GetAZs ''] Tags: - Key: Application Value: !Ref 'AWS::StackName' Subnet2: Type: 'AWS::EC2::Subnet' Properties: VpcId: !Ref VPC CidrBlock: 10.0.1.0/24 AvailabilityZone: !Select [1, !GetAZs ''] Tags: - Key: Application Value: !Ref 'AWS::StackName' Subnet3: Type: 'AWS::EC2::Subnet' Properties: VpcId: !Ref VPC CidrBlock: 10.0.2.0/24 AvailabilityZone: !Select [2, !GetAZs ''] Tags: - Key: Application Value: !Ref 'AWS::StackName' TargetDBSubnetGroup: Type: 'AWS::RDS::DBSubnetGroup' Properties: DBSubnetGroupDescription: Subnets available for the RDS DB Instance SubnetIds: - !Ref Subnet1 - !Ref Subnet2 - !Ref Subnet3 InternetGateway: Type: 'AWS::EC2::InternetGateway' Properties: Tags: - Key: Application Value: !Ref 'AWS::StackName' AttachGateway: Type: 'AWS::EC2::VPCGatewayAttachment' Properties: VpcId: !Ref VPC InternetGatewayId: !Ref InternetGateway RouteTable: Type: 'AWS::EC2::RouteTable' Properties: VpcId: !Ref VPC Tags: - Key: Application Value: !Ref 'AWS::StackName' Route: Type: 'AWS::EC2::Route' DependsOn: AttachGateway Properties: RouteTableId: !Ref RouteTable DestinationCidrBlock: 0.0.0.0/0 GatewayId: !Ref InternetGateway Subnet1RouteTableAssociation: Type: 'AWS::EC2::SubnetRouteTableAssociation' Properties: SubnetId: !Ref Subnet1 RouteTableId: !Ref RouteTable Subnet2RouteTableAssociation: Type: 'AWS::EC2::SubnetRouteTableAssociation' Properties: SubnetId: !Ref Subnet2 RouteTableId: !Ref RouteTable Subnet3RouteTableAssociation: Type: 'AWS::EC2::SubnetRouteTableAssociation' Properties: SubnetId: !Ref Subnet3 RouteTableId: !Ref RouteTable EC2Instance: Type: 'AWS::EC2::Instance' Properties: InstanceType: m5.xlarge ImageId: !FindInMap [RegionMap, !Ref "AWS::Region", HVM64] Tags: - Key: Name Value: OracleXE-SCT NetworkInterfaces: - AssociatePublicIpAddress: 'true' DeleteOnTermination: 'true' DeviceIndex: 0 SubnetId: !Ref Subnet1 GroupSet: - !Ref InstanceSecurityGroup InstanceSecurityGroup: Type: 'AWS::EC2::SecurityGroup' Properties: GroupDescription: Enable RDP access via port 3389 VpcId: !Ref VPC SecurityGroupIngress: - IpProtocol: tcp FromPort: '3389' ToPort: '3389' CidrIp: 0.0.0.0/0 - IpProtocol: tcp FromPort: '1521' ToPort: '1521' CidrIp: 10.0.0.0/16 AuroraPostgreSQLSecurityGroup: Type: 'AWS::EC2::SecurityGroup' Properties: VpcId: !Ref VPC GroupDescription: Aurora PostgreSQL Security Group SecurityGroupIngress: - IpProtocol: tcp FromPort: '5432' ToPort: '5432' CidrIp: 10.0.0.0/16 AuroraPostgreSQLDBCluster: Type: 'AWS::RDS::DBCluster' Properties: DBSubnetGroupName: !Ref TargetDBSubnetGroup DBClusterIdentifier : !Ref 'AWS::StackName' VpcSecurityGroupIds: - !GetAtt - AuroraPostgreSQLSecurityGroup - GroupId Engine: aurora-postgresql EngineVersion: '10.7' DatabaseName: AuroraPostgreSQLDB DBClusterParameterGroupName: default.aurora-postgresql10 MasterUsername: postgres MasterUserPassword: Aurora321 Port: '5432' BackupRetentionPeriod: '7' DependsOn: AuroraPostgreSQLSecurityGroup AuroraPostgreSQLDBInstance: Type: 'AWS::RDS::DBInstance' Properties: Engine: aurora-postgresql EngineVersion: '10.7' DBClusterIdentifier: !Ref AuroraPostgreSQLDBCluster DBSubnetGroupName: !Ref TargetDBSubnetGroup AutoMinorVersionUpgrade: 'false' CopyTagsToSnapshot: 'true' DBInstanceClass: db.r5.xlarge PubliclyAccessible: 'true' Outputs: VpcId: Description: 'VPC Id' Value: !Ref VPC OracleSCTInstancePrivateIP: Description: Private IP address of the newly created Oracle DB and SCT EC2 instance Value: !GetAtt - EC2Instance - PrivateIp AuroraPostgreSQLEndpoint: Description: Connection Endpoint for the newly created AuroraPostgreSQL RDS instance Value: !GetAtt - AuroraPostgreSQLDBCluster - Endpoint.Address