Skip to content

Commit

Permalink
add data tables
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesc Sastre Cabot committed Oct 26, 2022
1 parent bb6c324 commit 364f255
Show file tree
Hide file tree
Showing 5 changed files with 4,761 additions and 7,276 deletions.
25 changes: 24 additions & 1 deletion cdk/mundiagua-image-processing-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
CorsRule,
HttpMethods,
} from "aws-cdk-lib/aws-s3";
import { AttributeType, BillingMode, Table } from "aws-cdk-lib/aws-dynamodb";
import { LambdaDestination } from "aws-cdk-lib/aws-s3-notifications";
import { Runtime } from "aws-cdk-lib/aws-lambda";
import { NodejsFunction } from "aws-cdk-lib/aws-lambda-nodejs";
Expand Down Expand Up @@ -53,7 +54,7 @@ export class MundiaguaImageProcessingStack extends Stack {
"thumbnailGeneratorImage-" + this.props.stage,
{
memorySize: 512,
runtime: Runtime.NODEJS_14_X,
runtime: Runtime.NODEJS_16_X,
handler: "handler",
entry: path.join(__dirname, `/../src/images/generate-thumbnail.ts`),
timeout: Duration.seconds(30),
Expand All @@ -74,5 +75,27 @@ export class MundiaguaImageProcessingStack extends Stack {
imagesProcessingBucket.addObjectCreatedNotification(
new LambdaDestination(thumbnailLambda)
);

/*
* DATA TABLES
*/

const commonProps = {
billingMode: BillingMode.PAY_PER_REQUEST,
partitionKey: { name: "model", type: AttributeType.STRING },
sortKey: { name: "s3Key", type: AttributeType.STRING },
};

// DOCUMENTS
new Table(this, "uploaded-documents-" + this.props.stage, {
tableName: "uploaded-documents-" + this.props.stage,
...commonProps,
});

// IMAGES
new Table(this, "uploaded-images-" + this.props.stage, {
tableName: "uploaded-images-" + this.props.stage,
...commonProps,
});
}
}
Loading

0 comments on commit 364f255

Please sign in to comment.