diff --git a/docs/index.md b/docs/index.md index 8da0f26f870..8f199647e4f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -209,6 +209,42 @@ You can include Lambda Powertools Lambda Layer using [AWS Lambda Console](https: } ``` + === "Pulumi" + + ```python + import json + import pulumi + import pulumi_aws as aws + + role = aws.iam.Role("role", + assume_role_policy=json.dumps({ + "Version": "2012-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Principal": { + "Service": "lambda.amazonaws.com" + }, + "Effect": "Allow" + } + ] + }), + managed_policy_arns=[aws.iam.ManagedPolicy.AWS_LAMBDA_BASIC_EXECUTION_ROLE] + ) + + lambda_function = aws.lambda_.Function("function", + layers=[pulumi.Output.concat("arn:aws:lambda:",aws.get_region_output().name,":017000801446:layer:AWSLambdaPowertoolsPythonV2:11")], + tracing_config={ + "mode": "Active" + }, + runtime=aws.lambda_.Runtime.PYTHON3D9, + handler="index.handler", + role=role.arn, + architectures=["x86_64"], + code=pulumi.FileArchive("lambda_function_payload.zip") + ) + ``` + === "Amplify" ```zsh @@ -341,6 +377,42 @@ You can include Lambda Powertools Lambda Layer using [AWS Lambda Console](https: ``` + === "Pulumi" + + ```python + import json + import pulumi + import pulumi_aws as aws + + role = aws.iam.Role("role", + assume_role_policy=json.dumps({ + "Version": "2012-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Principal": { + "Service": "lambda.amazonaws.com" + }, + "Effect": "Allow" + } + ] + }), + managed_policy_arns=[aws.iam.ManagedPolicy.AWS_LAMBDA_BASIC_EXECUTION_ROLE] + ) + + lambda_function = aws.lambda_.Function("function", + layers=[pulumi.Output.concat("arn:aws:lambda:",aws.get_region_output().name,":017000801446:layer:AWSLambdaPowertoolsPythonV2-Arm64:11")], + tracing_config={ + "mode": "Active" + }, + runtime=aws.lambda_.Runtime.PYTHON3D9, + handler="index.handler", + role=role.arn, + architectures=["arm64"], + code=pulumi.FileArchive("lambda_function_payload.zip") + ) + ``` + === "Amplify" ```zsh