Skip to content

Commit c8465e2

Browse files
author
Florian Chazal
committed
remove layer from doc for now
1 parent d07ccf9 commit c8465e2

File tree

1 file changed

+0
-191
lines changed

1 file changed

+0
-191
lines changed

docs/index.md

Lines changed: 0 additions & 191 deletions
Original file line numberDiff line numberDiff line change
@@ -28,197 +28,6 @@ Core utilities such as Tracer, Logger, Metrics, and Event Handler will be availa
2828

2929
## Installation
3030

31-
You can use Powertools through [AWS Lambda Layer](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-concepts.html#gettingstarted-concepts-layer) or install it as your dependency via NPM:
32-
33-
* **Lambda Layer**: [**arn:aws:lambda:{region}:094274105915:layer:AWSLambdaPowertoolsTypeScript:1**](#){: .copyMe}:clipboard:
34-
* **NPM**: **`npm install @aws-lambda-powertools/tracer @aws-lambda-powertools/metrics @aws-lambda-powertools/logger`**
35-
36-
???+ hint "Support this project by using Lambda Layers :heart:"
37-
Lambda Layers allow us to understand who uses this library in a non-intrusive way. This helps us justify and gain future investments for other Lambda Powertools languages.
38-
39-
When using Layers, you can add Lambda Powertools as a dev dependency to not impact the development process.
40-
41-
42-
### Lambda Layer
43-
44-
[Lambda Layer](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html){target="_blank"} is a .zip file archive that can contain additional code, pre-packaged dependencies, data, or configuration files. Layers promote code sharing and separation of responsibilities so that you can iterate faster on writing business logic.
45-
46-
You can include Lambda Powertools Lambda Layer using [AWS Lambda Console](https://docs.aws.amazon.com/lambda/latest/dg/invocation-layers.html#invocation-layers-using){target="_blank"}, or your preferred deployment framework.
47-
48-
??? note "Note: Expand to copy any regional Lambda Layer ARN"
49-
50-
| Region | Layer ARN
51-
|--------------------------- | ---------------------------
52-
| `us-east-1` | [arn:aws:lambda:us-east-1:094274105915:layer:AWSLambdaPowertoolsTypeScript:1](#){: .copyMe}:clipboard:
53-
| `us-east-2` | [arn:aws:lambda:us-east-2:094274105915:layer:AWSLambdaPowertoolsTypeScript:1](#){: .copyMe}:clipboard:
54-
| `us-west-1` | [arn:aws:lambda:us-west-1:094274105915:layer:AWSLambdaPowertoolsTypeScript:1](#){: .copyMe}:clipboard:
55-
| `us-west-2` | [arn:aws:lambda:us-west-2:094274105915:layer:AWSLambdaPowertoolsTypeScript:1](#){: .copyMe}:clipboard:
56-
| `ap-south-1` | [arn:aws:lambda:ap-south-1:094274105915:layer:AWSLambdaPowertoolsTypeScript:1](#){: .copyMe}:clipboard:
57-
| `ap-northeast-1` | [arn:aws:lambda:ap-northeast-1:094274105915:layer:AWSLambdaPowertoolsTypeScript:1](#){: .copyMe}:clipboard:
58-
| `ap-northeast-2` | [arn:aws:lambda:ap-northeast-2:094274105915:layer:AWSLambdaPowertoolsTypeScript:1](#){: .copyMe}:clipboard:
59-
| `ap-northeast-3` | [arn:aws:lambda:ap-northeast-3:094274105915:layer:AWSLambdaPowertoolsTypeScript:1](#){: .copyMe}:clipboard:
60-
| `ap-southeast-1` | [arn:aws:lambda:ap-southeast-1:094274105915:layer:AWSLambdaPowertoolsTypeScript:1](#){: .copyMe}:clipboard:
61-
| `ap-southeast-2` | [arn:aws:lambda:ap-southeast-2:094274105915:layer:AWSLambdaPowertoolsTypeScript:1](#){: .copyMe}:clipboard:
62-
| `eu-central-1` | [arn:aws:lambda:eu-central-1:094274105915:layer:AWSLambdaPowertoolsTypeScript:1](#){: .copyMe}:clipboard:
63-
| `eu-west-1` | [arn:aws:lambda:eu-west-1:094274105915:layer:AWSLambdaPowertoolsTypeScript:1](#){: .copyMe}:clipboard:
64-
| `eu-west-2` | [arn:aws:lambda:eu-west-2:094274105915:layer:AWSLambdaPowertoolsTypeScript:1](#){: .copyMe}:clipboard:
65-
| `eu-west-3` | [arn:aws:lambda:eu-west-3:094274105915:layer:AWSLambdaPowertoolsTypeScript:1](#){: .copyMe}:clipboard:
66-
| `eu-north-1` | [arn:aws:lambda:eu-north-1:094274105915:layer:AWSLambdaPowertoolsTypeScript:1](#){: .copyMe}:clipboard:
67-
| `ca-central-1` | [arn:aws:lambda:ca-central-1:094274105915:layer:AWSLambdaPowertoolsTypeScript:1](#){: .copyMe}:clipboard:
68-
| `sa-east-1` | [arn:aws:lambda:sa-east-1:094274105915:layer:AWSLambdaPowertoolsTypeScript:1](#){: .copyMe}:clipboard:
69-
70-
??? question "Can't find our Lambda Layer for your preferred AWS region?"
71-
You can use our [CDK Layer Construct](https://github.com/aws-samples/cdk-lambda-powertools-python-layer){target="_blank"}, or NPM like you normally would for any other library.
72-
73-
Please do file a feature request with the region you'd want us to prioritize making our Lambda Layer available.
74-
75-
=== "SAM"
76-
77-
```yaml hl_lines="5"
78-
MyLambdaFunction:
79-
Type: AWS::Serverless::Function
80-
Properties:
81-
Layers:
82-
- !Sub arn:aws:lambda:${AWS::Region}:094274105915:layer:AWSLambdaPowertoolsTypeScript:1
83-
```
84-
85-
=== "Serverless framework"
86-
87-
```yaml hl_lines="5"
88-
functions:
89-
hello:
90-
handler: lambda_function.lambda_handler
91-
layers:
92-
- arn:aws:lambda:${aws:region}:094274105915:layer:AWSLambdaPowertoolsTypeScript:1
93-
```
94-
95-
=== "CDK"
96-
97-
```typescript hl_lines="11 16"
98-
import * as cdk from 'aws-cdk-lib';
99-
import { Construct } from 'constructs';
100-
import * as lambda from 'aws-cdk-lib/aws-lambda';
101-
102-
export class SampleFunctionWithLayer extends Construct {
103-
constructor(scope: Construct, id: string) {
104-
super(scope, id);
105-
// Create a Layer with AWS Lambda Powertools for TypeScript
106-
107-
const powertoolsLayer = lambda.LayerVersion.fromLayerVersionArn(
108-
this,
109-
'PowertoolsLayer',
110-
`arn:aws:lambda:${cdk.Stack.of(this).region}:094274105915:layer:AWSLambdaPowertoolsTypeScript:1`
111-
);
112-
new lambda.Function(this, 'Function', {
113-
runtime: lambda.Runtime.NODEJS_16_X,
114-
// Add the Layer to a Lambda function
115-
layers: [powertoolsLayer],
116-
code: lambda.Code.fromInline(`
117-
const { Logger } = require('@aws-lambda-powertools/logger');
118-
const { Metrics } = require('@aws-lambda-powertools/metrics');
119-
const { Tracer } = require('@aws-lambda-powertools/tracer');
120-
121-
const logger = new Logger({logLevel: 'DEBUG'});
122-
const metrics = new Metrics();
123-
const tracer = new Tracer();
124-
125-
exports.handler = function(event, ctx) {
126-
logger.debug("Hello World!");
127-
}`),
128-
handler: 'index.handler',
129-
});
130-
}
131-
}
132-
```
133-
134-
=== "Terraform"
135-
136-
```terraform hl_lines="9 38"
137-
terraform {
138-
required_version = "~> 1.0.5"
139-
required_providers {
140-
aws = "~> 3.50.0"
141-
}
142-
}
143-
144-
provider "aws" {
145-
region = "{region}"
146-
}
147-
148-
resource "aws_iam_role" "iam_for_lambda" {
149-
name = "iam_for_lambda"
150-
151-
assume_role_policy = <<EOF
152-
{
153-
"Version": "2012-10-17",
154-
"Statement": [
155-
{
156-
"Action": "sts:AssumeRole",
157-
"Principal": {
158-
"Service": "lambda.amazonaws.com"
159-
},
160-
"Effect": "Allow"
161-
}
162-
]
163-
}
164-
EOF
165-
}
166-
167-
resource "aws_lambda_function" "test_lambda" {
168-
filename = "lambda_function_payload.zip"
169-
function_name = "lambda_function_name"
170-
role = aws_iam_role.iam_for_lambda.arn
171-
handler = "index.test"
172-
runtime = "nodejs16.x"
173-
layers = ["arn:aws:lambda:{region}:094274105915:layer:AWSLambdaPowertoolsTypeScript:1"]
174-
175-
source_code_hash = filebase64sha256("lambda_function_payload.zip")
176-
}
177-
178-
179-
```
180-
181-
=== "Amplify"
182-
183-
```zsh
184-
# Create a new one with the layer
185-
❯ amplify add function
186-
? Select which capability you want to add: Lambda function (serverless function)
187-
? Provide an AWS Lambda function name: <NAME-OF-FUNCTION>
188-
? Choose the runtime that you want to use: NodeJS
189-
? Do you want to configure advanced settings? Yes
190-
...
191-
? Do you want to enable Lambda layers for this function? Yes
192-
? Enter up to 5 existing Lambda layer ARNs (comma-separated): arn:aws:lambda:eu-central-1:094274105915:layer:AWSLambdaPowertoolsTypeScript:1
193-
❯ amplify push -y
194-
195-
196-
# Updating an existing function and add the layer
197-
❯ amplify update function
198-
? Select the Lambda function you want to update test2
199-
General information
200-
- Name: <NAME-OF-FUNCTION>
201-
? Which setting do you want to update? Lambda layers configuration
202-
? Do you want to enable Lambda layers for this function? Yes
203-
? Enter up to 5 existing Lambda layer ARNs (comma-separated): arn:aws:lambda:eu-central-1:094274105915:layer:AWSLambdaPowertoolsTypeScript:1
204-
? Do you want to edit the local lambda function now? No
205-
```
206-
207-
=== "Get the Layer .zip contents"
208-
Change `{region}` to your AWS region, e.g. `eu-west-1`
209-
210-
```bash title="AWS CLI"
211-
aws lambda get-layer-version-by-arn --arn arn:aws:lambda:{region}:094274105915:layer:AWSLambdaPowertoolsTypeScript:1 --region {region}
212-
```
213-
214-
The pre-signed URL to download this Lambda Layer will be within `Location` key.
215-
216-
???+ warning "Warning: Limitations"
217-
218-
Container Image deployment (OCI) or inline Lambda functions do not support Lambda Layers.
219-
220-
### NPM Modules
221-
22231
The AWS Lambda Powertools for TypeScript utilities (which from here will be referred as Powertools) follow a modular approach, similar to the official [AWS SDK v3 for JavaScript](https://github.com/aws/aws-sdk-js-v3).
22332
Each TypeScript utility is installed as standalone NPM package.
22433

0 commit comments

Comments
 (0)