Skip to content

Commit d9f5bcc

Browse files
committed
upgrade cdk + fix warnings
1 parent 04ac0a5 commit d9f5bcc

File tree

3 files changed

+162
-68
lines changed

3 files changed

+162
-68
lines changed

packages/infra/cdk/aws-sdk-js-notes-app-stack.ts

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -134,30 +134,35 @@ export class AwsSdkJsNotesAppStack extends Stack {
134134
bucketName: "notes-app-frontend",
135135
});
136136

137-
const distribution = new cloudfront.Distribution(this, "WebsiteDistribution", {
138-
defaultRootObject: "index.html",
139-
defaultBehavior: {
140-
origin: new origins.S3Origin(websiteBucket),
141-
},
142-
errorResponses: [
143-
{
144-
httpStatus: 403,
145-
responseHttpStatus: 200,
146-
responsePagePath: '/index.html',
147-
},
148-
{
149-
httpStatus: 404,
150-
responseHttpStatus: 200,
151-
responsePagePath: '/index.html',
137+
const distribution = new cloudfront.Distribution(
138+
this,
139+
"WebsiteDistribution",
140+
{
141+
defaultRootObject: "index.html",
142+
defaultBehavior: {
143+
origin: origins.S3BucketOrigin.withOriginAccessControl(websiteBucket),
152144
},
153-
],
154-
});
145+
errorResponses: [
146+
{
147+
httpStatus: 403,
148+
responseHttpStatus: 200,
149+
responsePagePath: "/index.html",
150+
},
151+
{
152+
httpStatus: 404,
153+
responseHttpStatus: 200,
154+
responsePagePath: "/index.html",
155+
},
156+
],
157+
}
158+
);
155159

156160
new CfnOutput(this, "FilesBucket", { value: filesBucket.bucketName });
157161
new CfnOutput(this, "GatewayId", { value: api.restApiId });
158162
new CfnOutput(this, "IdentityPoolId", { value: identityPool.ref });
159163
new CfnOutput(this, "Region", { value: this.region });
160-
new CfnOutput(this, "FrontendDistributionId", { value: distribution.distributionId });
161-
164+
new CfnOutput(this, "FrontendDistributionId", {
165+
value: distribution.distributionId,
166+
});
162167
}
163168
}

packages/infra/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
},
1111
"devDependencies": {
1212
"@types/node": "^18.11.18",
13-
"aws-cdk": "2.59.0",
13+
"aws-cdk": "2.1010.0",
1414
"typescript": "~4.9.4"
1515
},
1616
"dependencies": {
17-
"aws-cdk-lib": "2.59.0",
17+
"aws-cdk-lib": "2.190.0",
1818
"constructs": "10.1.215"
1919
}
2020
}

0 commit comments

Comments
 (0)