Configuration
Lack uses a lack.config.js
file for configuration. TypeScript files are not supported.
Properties
name: string
: a name for the cloudformation stackllrt: string
: this points to a llrt zip file for the lambdas. You can download it from the LLRT GitHub. This will be autodownloaded in the future.function cdk(stack: Stack)
- This is used for further configuration of CDK It will run before the Lambda creation. The 1st and only argument is the CDK stack. You do anything you'd like here. eg. Create a DynamoDB table.
The return type is
Promise<{ env?: Record<string, string>, post?: async (lambdas: aws_lambda.Fucntion[]) }>
- env: define env variables for every Lambda function.
- post: a function that will run post Lambda creation, used for granting permitions to your Lambdas for example.
Example
import { aws_dynamodb } from "aws-cdk-lib";
export function cdk(stack) {
const table = new aws_dynamodb.Table(stack, "Table", {
partitionKey: {
name: "id",
type: aws_dynamodb.AttributeType.STRING,
},
billingMode: aws_dynamodb.BillingMode.PAY_PER_REQUEST,
});
return {
env: { TABLE_NAME: table.tableName },
post: async (lambdas) => {
lambdas.forEach((x) => table.grantReadWriteData(x));
},
};
}
export const llrt = "./llrt-lambda-arm64.zip";
export const name = "hello-llrt";