-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d517e21
commit 8c72c52
Showing
6 changed files
with
105 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,4 @@ cdk.context.json | |
# CDK asset staging directory | ||
.cdk.staging | ||
cdk.out/ | ||
cdk.context.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Stack, StackProps } from "aws-cdk-lib"; | ||
import { LambdaIntegration } from "aws-cdk-lib/aws-apigateway"; | ||
import { Table } from "aws-cdk-lib/aws-dynamodb"; | ||
import { Construct } from "constructs"; | ||
import { DemoReviewLambda } from "../../functions/demo-review-lambda/config"; | ||
import { getCertificateArn, getDomainName } from "../../helpers"; | ||
import { OrionApi } from "../constructs/api-gateway"; | ||
import { ReviewBucket } from "../constructs/review-bucket"; | ||
|
||
interface DemoStackProps extends StackProps { | ||
stage: string; | ||
userTable: Table; | ||
} | ||
|
||
export class DemoStack extends Stack { | ||
constructor(scope: Construct, id: string, props: DemoStackProps) { | ||
super(scope, id, props); | ||
|
||
// Separate API for the demo to enable strong throttling | ||
const demoApi = new OrionApi(this, "demo-api", { | ||
deployOptions: { | ||
throttlingBurstLimit: 1, | ||
throttlingRateLimit: 1, | ||
}, | ||
rootDomain: getDomainName(props.stage), | ||
subDomain: "demo", | ||
certificateArn: getCertificateArn(this, "demo"), | ||
}); | ||
|
||
//Resources | ||
const demoReviewBucket = new ReviewBucket(this, "demo-review-bucket"); | ||
|
||
//Lambda | ||
const demoReviewLambda = new DemoReviewLambda(this, "demo-review-lambda", { | ||
table: props.userTable, | ||
bucket: demoReviewBucket, | ||
}); | ||
|
||
//Routes | ||
const demoReviewRoute = demoApi.root.addResource("demoReview"); | ||
demoReviewRoute.addMethod("POST", new LambdaIntegration(demoReviewLambda)); | ||
} | ||
} |