Skip to content

Commit 3183562

Browse files
committed
1 parent 525e928 commit 3183562

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

cdk/lib/constructs/network.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ export class Network extends Construct {
1818
constructor(scope: Construct, id: string, props: NetworkProps) {
1919
super(scope, id);
2020

21-
// VPC (1 public subnet and 1 private subnet)
21+
// VPC (1 public subnet, 1 private subnet with NAT Gateway, and 1 isolated subnet)
2222
const vpc = new Vpc(this, 'Vpc', {
2323
maxAzs: 2,
24-
natGateways: 0,
24+
natGateways: 1,
2525
subnetConfiguration: [
2626
{
2727
cidrMask: 24,
@@ -31,6 +31,11 @@ export class Network extends Construct {
3131
{
3232
cidrMask: 24,
3333
name: 'private',
34+
subnetType: SubnetType.PRIVATE_WITH_EGRESS,
35+
},
36+
{
37+
cidrMask: 24,
38+
name: 'isolated',
3439
subnetType: SubnetType.PRIVATE_ISOLATED,
3540
},
3641
],
@@ -60,7 +65,7 @@ export class Network extends Construct {
6065
this,
6166
'InstanceConnectEndpoint',
6267
{
63-
subnetId: vpc.isolatedSubnets[0].subnetId,
68+
subnetId: vpc.privateSubnets[0].subnetId,
6469
preserveClientIp: false,
6570
securityGroupIds: [sgIce.securityGroupId],
6671
}

cdk/lib/constructs/oracle-db-instance.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export class OracleDbInstance extends Construct {
3737

3838
readonly outputs: {
3939
ScriptBucketName: string;
40-
OracleInstancePublicIP: string;
4140
OracleInstanceId: string;
4241
OracleKeyPairRetrievalCommand: string;
4342
SSHCommand: string;
@@ -162,7 +161,7 @@ export class OracleDbInstance extends Construct {
162161
userData: userDataScript,
163162
role: instanceRole,
164163
vpcSubnets: {
165-
subnetType: SubnetType.PUBLIC,
164+
subnetType: SubnetType.PRIVATE_WITH_EGRESS,
166165
},
167166
detailedMonitoring: true,
168167
// Increase root volume size to accommodate Oracle XE
@@ -184,7 +183,6 @@ export class OracleDbInstance extends Construct {
184183

185184
this.outputs = {
186185
ScriptBucketName: scriptBucket.bucketName,
187-
OracleInstancePublicIP: oracleInstance.instancePublicIp,
188186
OracleInstanceId: oracleInstance.instanceId,
189187
OracleKeyPairRetrievalCommand: Fn.join('', [
190188
'aws ssm get-parameter --name /ec2/keypair/',
@@ -194,8 +192,7 @@ export class OracleDbInstance extends Construct {
194192
' --with-decryption --query Parameter.Value --output text > ../oracle-xe-key.pem && chmod 400 ../oracle-xe-key.pem',
195193
]),
196194
SSHCommand: Fn.join('', [
197-
'ssh -i oracle-xe-key.pem ec2-user@',
198-
oracleInstance.instancePublicIp,
195+
'ssh -F ssh-config oracle',
199196
]),
200197
};
201198

cdk/lib/sql-converter-agent-stack.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,6 @@ export class SqlConverterAgentStack extends Stack {
4141
description: 'ScriptBucketName',
4242
});
4343

44-
// Output the EC2 instance public IP
45-
new CfnOutput(this, 'OracleInstancePublicIP', {
46-
exportName: 'OracleInstancePublicIP',
47-
value: oracleDb.outputs.OracleInstancePublicIP,
48-
description: 'Public IP address of the Oracle XE instance',
49-
});
50-
5144
// Output the EC2 instance ID
5245
new CfnOutput(this, 'OracleInstanceId', {
5346
exportName: 'OracleInstanceId',

0 commit comments

Comments
 (0)