1.4.16 • Published 9 months ago
@liflig/cdk-lambda-config v1.4.16
CDK Construct for adding config.json file to a Lambda Function
When using Lambda@Edge, a function cannot use environment variables.
This CDK Construct uses a Custom Resource to inject a config.json
file with user provided values into an existing function, and
publishes a new version that is ready to be used as part of a
CloudFront Distribution.
Inspired by similar mechanism in https://github.com/aws-samples/cloudfront-authorization-at-edge/
Usage
npm install @liflig/cdk-lambda-config
Using the construct:
const originalFunction = lambda.Function.fromFunctionArn(...)
const updatedFunction = new LambdaConfig(this, "UpdatedFunction", {
function: originalFunction,
config: {
Key1: "Some value",
Nested: {
Key2: "Other value",
},
},
nonce: "1", // See TSDoc.
})
// Can now retrieve the new version:
updatedFunction.version
Read from within the handler:
const fs = require("fs")
const path = require("path")
const config = JSON.parse(
fs.readFileSync(path.join(__dirname, "config.json"), "utf-8"),
)
1.4.15
10 months ago
1.4.16
9 months ago
1.4.14
10 months ago
1.4.13
11 months ago
1.4.11
11 months ago
1.4.12
11 months ago
1.4.10
11 months ago
1.4.9
11 months ago
1.4.8
11 months ago
1.4.7
11 months ago
1.4.6
11 months ago
1.4.5
11 months ago
1.4.4
11 months ago
1.4.3
11 months ago
1.4.2
11 months ago
1.4.1
12 months ago
1.4.0
12 months ago
1.3.1
12 months ago
1.3.0
12 months ago
1.2.0
1 year ago
1.1.1
1 year ago
1.1.0
1 year ago
1.0.0
1 year ago