Skip to content

Instantly share code, notes, and snippets.

@mikhailshilkov
Created February 8, 2019 08:02
Show Gist options
  • Save mikhailshilkov/0d50f399ab6c7dbe04de98c8f11c3ad1 to your computer and use it in GitHub Desktop.
Save mikhailshilkov/0d50f399ab6c7dbe04de98c8f11c3ad1 to your computer and use it in GitHub Desktop.
// Create a Role giving our Lambda access.
let policy: aws.iam.PolicyDocument = { /* Redacted for brevity */ };
let role = new aws.iam.Role("lambda-role", {
assumeRolePolicy: JSON.stringify(policy),
});
let fullAccess = new aws.iam.RolePolicyAttachment("lambda-access", {
role: role,
policyArn: aws.iam.AWSLambdaFullAccess,
});
// Create a Lambda function, using code from the `./app` folder.
let lambda = new aws.lambda.Function("lambda-get", {
runtime: aws.lambda.NodeJS8d10Runtime,
code: new pulumi.asset.AssetArchive({
".": new pulumi.asset.FileArchive("./app"),
}),
timeout: 300,
handler: "read.handler",
role: role.arn,
environment: {
variables: {
"COUNTER_TABLE": counterTable.name
}
},
}, { dependsOn: [fullAccess] });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment