Skip to content

docs(homepage): add Pulumi code example #1652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down