-
Notifications
You must be signed in to change notification settings - Fork 11
/
GPSTEC315_lab_setup.yaml
175 lines (175 loc) · 5.01 KB
/
GPSTEC315_lab_setup.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
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