Skip to content

Commit 6dc2bef

Browse files
Added Pulumi code to deploy lambda with powertools (#1135)
* Added Pulumi code to deploy lambda with powertools * Update docs/index.md Co-authored-by: Leandro Damascena <[email protected]> * Update docs/index.md Co-authored-by: Leandro Damascena <[email protected]> Co-authored-by: Leandro Damascena <[email protected]>
1 parent b209c30 commit 6dc2bef

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Diff for: docs/index.md

+26
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,32 @@ You can include Lambda Powertools Lambda Layer using [AWS Lambda Console](https:
186186
}
187187
```
188188

189+
=== "Pulumi"
190+
191+
```typescript hl_lines="11"
192+
import * as pulumi from "@pulumi/pulumi";
193+
import * as aws from "@pulumi/aws";
194+
195+
const role = new aws.iam.Role("role", {
196+
assumeRolePolicy: aws.iam.assumeRolePolicyForPrincipal(aws.iam.Principals.LambdaPrincipal),
197+
managedPolicyArns: [aws.iam.ManagedPolicies.AWSLambdaBasicExecutionRole]
198+
});
199+
200+
const lambdaFunction = new aws.lambda.Function("function", {
201+
layers: [
202+
pulumi.interpolate`arn:aws:lambda:${aws.getRegionOutput().name}:094274105915:layer:AWSLambdaPowertoolsTypeScript:3`
203+
],
204+
code: new pulumi.asset.FileArchive("lambda_function_payload.zip"),
205+
tracingConfig: {
206+
mode: "Active"
207+
},
208+
runtime: aws.lambda.Runtime.NodeJS16dX,
209+
handler: "index.handler",
210+
role: role.arn,
211+
architectures: ["x86_64"]
212+
});
213+
```
214+
189215
=== "Amplify"
190216

191217
```zsh

0 commit comments

Comments
 (0)