Skip to content

Commit 767987c

Browse files
Alexheitorlessa
Alex
andauthored
docs: add new public layer ARNs (#746)
Co-authored-by: heitorlessa <[email protected]>
1 parent 0334984 commit 767987c

File tree

4 files changed

+145
-2
lines changed

4 files changed

+145
-2
lines changed

Diff for: docs/index.md

+120-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,126 @@ Powertools is available in PyPi. You can use your favourite dependency managemen
3636

3737
### Lambda Layer
3838

39-
Powertools is also available as a Lambda Layer, and it is distributed via the [AWS Serverless Application Repository (SAR)](https://docs.aws.amazon.com/serverlessrepo/latest/devguide/what-is-serverlessrepo.html) to support semantic versioning.
39+
Powertools is also available as a Lambda Layer with public ARNs in each region or distributed via the [AWS Serverless Application Repository (SAR)](https://docs.aws.amazon.com/serverlessrepo/latest/devguide/what-is-serverlessrepo.html) to support semantic versioning.
40+
41+
#### Public ARNs
42+
43+
We build, release and distribute packaged Lambda Powertools layers for each region. This means you can copy a specific ARN and use it in your Lambda deployment. The layer region must be equal to the region of your lambda function. The public layers do not contain the `pydantic` library that is required for the `parser` utility.
44+
45+
46+
=== "SAM"
47+
48+
```yaml hl_lines="5"
49+
MyLambdaFunction:
50+
Type: AWS::Serverless::Function
51+
Properties:
52+
Layers:
53+
- arn:aws:lambda:us-east-1:017000801446:layer:AWSLambdaPowertoolsPython:3
54+
```
55+
56+
=== "Serverless framework"
57+
58+
```yaml hl_lines="5"
59+
functions:
60+
main:
61+
handler: lambda_function.lambda_handler
62+
layers:
63+
- arn:aws:lambda:us-east-1:017000801446:layer:AWSLambdaPowertoolsPython:3
64+
```
65+
66+
=== "CDK"
67+
68+
```python hl_lines="14"
69+
from aws_cdk import core, aws_lambda
70+
71+
class SampleApp(core.Construct):
72+
73+
def __init__(self, scope: core.Construct, id_: str) -> None:
74+
super().__init__(scope, id_)
75+
76+
aws_lambda.Function(self,
77+
'sample-app-lambda',
78+
runtime=aws_lambda.Runtime.PYTHON_3_8,
79+
function_name='sample-lambda',
80+
code=aws_lambda.Code.asset('./src'),
81+
handler='app.handler',
82+
layers: ["arn:aws:lambda:us-east-1:017000801446:layer:AWSLambdaPowertoolsPython:3"]
83+
)
84+
```
85+
86+
=== "Terraform"
87+
88+
```terraform hl_lines="9 38"
89+
terraform {
90+
required_version = "~> 1.0.5"
91+
required_providers {
92+
aws = "~> 3.50.0"
93+
}
94+
}
95+
96+
provider "aws" {
97+
region = "us-east-1"
98+
}
99+
100+
resource "aws_iam_role" "iam_for_lambda" {
101+
name = "iam_for_lambda"
102+
103+
assume_role_policy = <<EOF
104+
{
105+
"Version": "2012-10-17",
106+
"Statement": [
107+
{
108+
"Action": "sts:AssumeRole",
109+
"Principal": {
110+
"Service": "lambda.amazonaws.com"
111+
},
112+
"Effect": "Allow",
113+
"Sid": ""
114+
}
115+
]
116+
}
117+
EOF
118+
}
119+
120+
resource "aws_lambda_function" "test_lambda" {
121+
filename = "lambda_function_payload.zip"
122+
function_name = "lambda_function_name"
123+
role = aws_iam_role.iam_for_lambda.arn
124+
handler = "index.test"
125+
runtime = "python3.8"
126+
layers = ["arn:aws:lambda:us-east-1:017000801446:layer:AWSLambdaPowertoolsPython:3"]
127+
128+
source_code_hash = filebase64sha256("lambda_function_payload.zip")
129+
}
130+
131+
132+
```
133+
134+
??? note "Layer ARN per region"
135+
136+
!!! tip "Click to copy to clipboard"
137+
138+
| Region | Version | Layer ARN
139+
|---------------------------| ---------------------------| ---------------------------
140+
| `us-east-1` | `1.21.0` |[arn:aws:lambda:us-east-1:017000801446:layer:AWSLambdaPowertoolsPython:3](#) {: .copyMe}
141+
| `us-east-2` | `1.21.0` |[arn:aws:lambda:us-east-2:017000801446:layer:AWSLambdaPowertoolsPython:3](#) {: .copyMe}
142+
| `us-west-1` | `1.21.0` |[arn:aws:lambda:us-west-1:017000801446:layer:AWSLambdaPowertoolsPython:3](#) {: .copyMe}
143+
| `us-west-2` | `1.21.0` |[arn:aws:lambda:us-west-2:017000801446:layer:AWSLambdaPowertoolsPython:3](#) {: .copyMe}
144+
| `ap-south-1` | `1.21.0` |[arn:aws:lambda:ap-south-1:017000801446:layer:AWSLambdaPowertoolsPython:3](#) {: .copyMe}
145+
| `ap-northeast-1` | `1.21.0` |[arn:aws:lambda:ap-northeast-1:017000801446:layer:AWSLambdaPowertoolsPython:3](#) {: .copyMe}
146+
| `ap-northeast-2` | `1.21.0` |[arn:aws:lambda:ap-northeast-2:017000801446:layer:AWSLambdaPowertoolsPython:3](#) {: .copyMe}
147+
| `ap-northeast-3` | `1.21.0` |[arn:aws:lambda:ap-northeast-3:017000801446:layer:AWSLambdaPowertoolsPython:3](#) {: .copyMe}
148+
| `ap-southeast-1` | `1.21.0` |[arn:aws:lambda:ap-southeast-1:017000801446:layer:AWSLambdaPowertoolsPython:3](#) {: .copyMe}
149+
| `ap-southeast-2` | `1.21.0` |[arn:aws:lambda:ap-southeast-2:017000801446:layer:AWSLambdaPowertoolsPython:3](#) {: .copyMe}
150+
| `eu-central-1` | `1.21.0` |[arn:aws:lambda:eu-central-1:017000801446:layer:AWSLambdaPowertoolsPython:3](#) {: .copyMe}
151+
| `eu-west-1` | `1.21.0` |[arn:aws:lambda:eu-west-1:017000801446:layer:AWSLambdaPowertoolsPython:3](#) {: .copyMe}
152+
| `eu-west-2` | `1.21.0` |[arn:aws:lambda:eu-west-2:017000801446:layer:AWSLambdaPowertoolsPython:3](#) {: .copyMe}
153+
| `eu-west-3` | `1.21.0` |[arn:aws:lambda:eu-west-3:017000801446:layer:AWSLambdaPowertoolsPython:3](#) {: .copyMe}
154+
| `eu-north-1` | `1.21.0` |[arn:aws:lambda:eu-north-1:017000801446:layer:AWSLambdaPowertoolsPython:3](#) {: .copyMe}
155+
| `ca-central-1` | `1.21.0` |[arn:aws:lambda:ca-central-1:017000801446:layer:AWSLambdaPowertoolsPython:3](#) {: .copyMe}
156+
| `sa-east-1` | `1.21.0` |[arn:aws:lambda:sa-east-1:017000801446:layer:AWSLambdaPowertoolsPython:3](#) {: .copyMe}
157+
158+
#### SAR
40159

41160
| App | ARN | Description
42161
|----------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------

Diff for: docs/javascript/extra.js

+19-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ const awsconfig = {
1111

1212
const RUNTIME = "python"
1313

14-
const attachListeners = () => {
14+
function copyToClipboard(e) {
15+
e.preventDefault()
16+
navigator.clipboard.writeText(e.target.textContent)
17+
alert$.next("Copied to clipboard")
18+
}
19+
20+
function enableSearchOnBlurElement() {
1521
/* Register handler to log search on blur */
1622
document.addEventListener("DOMContentLoaded", function () {
1723
recordPageView({
@@ -41,6 +47,18 @@ const attachListeners = () => {
4147
};
4248
}
4349

50+
function enableClipboardElements() {
51+
let copyElements = document.querySelectorAll('.copyMe');
52+
copyElements.forEach(element => {
53+
element.addEventListener('click', copyToClipboard);
54+
})
55+
}
56+
57+
const attachListeners = () => {
58+
enableSearchOnBlurElement()
59+
enableClipboardElements()
60+
}
61+
4462
const init = () => {
4563
Analytics.addPluggable(new KinesisFirehoseProvider())
4664
Amplify.configure(awsconfig);

Diff for: docs/stylesheets/extra.css

+5
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,8 @@
3333
[data-md-color-scheme="slate"] {
3434
--md-typeset-a-color: rgb(28, 152, 152)
3535
}
36+
37+
.copyMe {
38+
cursor: pointer;
39+
border-bottom: 0.1px dashed black;
40+
}

Diff for: mkdocs.yml

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ markdown_extensions:
6969
- attr_list
7070
- pymdownx.emoji
7171
- pymdownx.inlinehilite
72+
- attr_list
7273

7374
copyright: Copyright &copy; 2021 Amazon Web Services
7475

0 commit comments

Comments
 (0)