Skip to content

Commit a757f3e

Browse files
authored
Merge pull request #144 from aws-samples/wangzt-dev
fixed some inconsistency in cdk
2 parents d65264f + a9a0b53 commit a757f3e

File tree

2 files changed

+18
-32
lines changed

2 files changed

+18
-32
lines changed

source/resources/lib/ecs/ecs-stack.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ constructor(scope: Construct, id: string, props: cdk.StackProps
1919
& {OSHostSecretName: string}) {
2020
super(scope, id, props);
2121

22-
// 选择所有的 isolated 和 private with egress 子网
2322
// const isolatedSubnets = this._vpc.selectSubnets({ subnetType: ec2.SubnetType.PRIVATE_ISOLATED }).subnets;
2423
// const privateSubnets = this._vpc.selectSubnets({ subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }).subnets;
2524

26-
// 合并所有非公共子网
2725
// const nonPublicSubnets = [...isolatedSubnets, ...privateSubnets];
2826
// const subnets = this._vpc.selectSubnets().subnets;
2927

@@ -34,14 +32,6 @@ constructor(scope: Construct, id: string, props: cdk.StackProps
3432
{ name: 'genbi-frontend', dockerfile: 'Dockerfile', port: 80, dockerfileDirectory: path.join(__dirname, '../../../../report-front-end')},
3533
];
3634

37-
// const repositoriesAndImages = services.map(service => {
38-
// const dockerImageAsset = new DockerImageAsset(this, `${service.name}DockerImage`, {
39-
// directory: service.dockerfileDirectory, // Dockerfile location
40-
// file: service.dockerfile, // Dockerfile filename
41-
// });
42-
// return { dockerImageAsset, port: service.port };
43-
// });
44-
4535
const GenBiStreamlitDockerImageAsset = {'dockerImageAsset': new DockerImageAsset(this, 'GenBiStreamlitDockerImage', {
4636
directory: services[0].dockerfileDirectory,
4737
file: services[0].dockerfile,
@@ -186,7 +176,7 @@ constructor(scope: Construct, id: string, props: cdk.StackProps
186176
taskDefinition: taskDefinitionStreamlit,
187177
publicLoadBalancer: true,
188178
taskSubnets: { subnets: props.subnets },
189-
assignPublicIp: false
179+
assignPublicIp: true
190180
});
191181

192182
// ======= 2. API Service =======
@@ -226,7 +216,7 @@ constructor(scope: Construct, id: string, props: cdk.StackProps
226216
taskDefinition: taskDefinitionAPI,
227217
publicLoadBalancer: true,
228218
taskSubnets: { subnets: props.subnets },
229-
assignPublicIp: false
219+
assignPublicIp: true
230220
});
231221

232222
// ======= 3. Frontend Service =======
@@ -273,7 +263,7 @@ constructor(scope: Construct, id: string, props: cdk.StackProps
273263
publicLoadBalancer: true,
274264
// taskSubnets: { subnetType: ec2.SubnetType.PUBLIC },
275265
taskSubnets: { subnets: props.subnets },
276-
assignPublicIp: false
266+
assignPublicIp: true
277267
});
278268

279269
this.streamlitEndpoint = fargateServiceStreamlit.loadBalancer.loadBalancerDnsName;

source/resources/lib/main-stack.ts

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as cdk from 'aws-cdk-lib';
33
import { Construct } from 'constructs';
44
import * as ec2 from 'aws-cdk-lib/aws-ec2';
55
import { AOSStack } from './aos/aos-stack';
6-
import { LLMStack } from './model/llm-stack';
6+
// import { LLMStack } from './model/llm-stack';
77
import { ECSStack } from './ecs/ecs-stack';
88
import { CognitoStack } from './cognito/cognito-stack';
99
import { RDSStack } from './rds/rds-stack';
@@ -25,11 +25,11 @@ export class MainStack extends cdk.Stack {
2525
});
2626

2727
// ======== Step 1. Define the LLMStack =========
28-
const s3ModelAssetsBucket = new CfnParameter(this, "S3ModelAssetsBucket", {
29-
type: "String",
30-
description: "S3 Bucket for model & code assets",
31-
default: "not-set"
32-
});
28+
// const s3ModelAssetsBucket = new CfnParameter(this, "S3ModelAssetsBucket", {
29+
// type: "String",
30+
// description: "S3 Bucket for model & code assets",
31+
// default: "not-set"
32+
// });
3333

3434
// ======== Step 2. Define the AOSStack =========
3535
const _AosStack = new AOSStack(this, 'aos-Stack', {
@@ -41,9 +41,15 @@ export class MainStack extends cdk.Stack {
4141
const aosEndpoint = _AosStack.endpoint;
4242

4343
// ======== Step 3. Define the RDSStack =========
44-
// const _RdsStack = new RDSStack(this, 'rds-Stack', {
45-
// env: props.env,
46-
// });
44+
if (_deployRds) {
45+
const _RdsStack = new RDSStack(this, 'rds-Stack', {
46+
env: props.env,
47+
});
48+
new cdk.CfnOutput(this, 'RDSEndpoint', {
49+
value: _RdsStack.endpoint,
50+
description: 'The endpoint of the RDS instance',
51+
});
52+
}
4753

4854
// ======== Step 4. Define Cognito =========
4955
const _CognitoStack = new CognitoStack(this, 'cognito-Stack', {
@@ -71,16 +77,6 @@ export class MainStack extends cdk.Stack {
7177
description: 'The endpoint of the OpenSearch domain'
7278
});
7379

74-
if (_deployRds) {
75-
const _RdsStack = new RDSStack(this, 'rds-Stack', {
76-
env: props.env,
77-
});
78-
new cdk.CfnOutput(this, 'RDSEndpoint', {
79-
value: _RdsStack.endpoint,
80-
description: 'The endpoint of the RDS instance',
81-
});
82-
}
83-
8480
new cdk.CfnOutput(this, 'StreamlitEndpoint', {
8581
value: _EcsStack.streamlitEndpoint,
8682
description: 'The endpoint of the Streamlit service'

0 commit comments

Comments
 (0)