Skip to content

Commit 319c363

Browse files
author
Alex
authored
docs: add description where to find the layer arn (#145)
* add description where to find the layer arn * add layer ARN reference to docs and the example project
1 parent ac8c16e commit 319c363

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

Diff for: docs/content/index.mdx

+13
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,19 @@ If using SAM, you can include this SAR App as part of your shared Layers stack,
4444
SemanticVersion: 1.3.1 # change to latest semantic version available in SAR
4545
```
4646
47+
This will add a nested app stack with an output parameter `LayerVersionArn`, that you can reference inside your Lambda function definition:
48+
49+
```yaml
50+
Layers:
51+
- !GetAtt AwsLambdaPowertoolsPythonLayer.Outputs.LayerVersionArn
52+
```
53+
54+
You can fetch the available versions via the API with:
55+
56+
```bash
57+
aws serverlessrepo list-application-versions --application-id arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer
58+
```
59+
4760
## Features
4861

4962
Utility | Description

Diff for: example/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The first command will build the source of your application. The second command
5555
* **Stack Name**: The name of the stack to deploy to CloudFormation. This should be unique to your account and region, and a good starting point would be something matching your project name.
5656
* **AWS Region**: The AWS region you want to deploy your app to.
5757
* **Confirm changes before deploy**: If set to yes, any change sets will be shown to you before execution for manual review. If set to no, the AWS SAM CLI will automatically deploy application changes.
58-
* **Allow SAM CLI IAM role creation**: Many AWS SAM templates, including this example, create AWS IAM roles required for the AWS Lambda function(s) included to access AWS services. By default, these are scoped down to minimum required permissions. To deploy an AWS CloudFormation stack which creates or modified IAM roles, the `CAPABILITY_IAM` value for `capabilities` must be provided. If permission isn't provided through this prompt, to deploy this example you must explicitly pass `--capabilities CAPABILITY_IAM` to the `sam deploy` command.
58+
* **Allow SAM CLI IAM role creation**: Many AWS SAM templates, including this example, create AWS IAM roles required for the AWS Lambda function(s) included to access AWS services. By default, these are scoped down to minimum required permissions. To deploy an AWS CloudFormation stack which creates or modified IAM roles, the `CAPABILITY_IAM` value for `capabilities` must be provided. If permission isn't provided through this prompt, to deploy this example you must explicitly pass `--capabilities CAPABILITY_IAM` to the `sam deploy` command. If you are using `AWS::Serverless::Application` as a layer, you need also to pass `CAPABILITY_AUTO_EXPAND` during `sam deploy`, because it will create a nested stack for the layer.
5959
* **Save arguments to samconfig.toml**: If set to yes, your choices will be saved to a configuration file inside the project, so that in the future you can just re-run `sam deploy` without parameters to deploy changes to your application.
6060

6161
You can find your API Gateway Endpoint URL in the output values displayed after deployment.

Diff for: example/template.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Resources:
1717
CodeUri: hello_world/
1818
Handler: app.lambda_handler
1919
Runtime: python3.8
20+
Layers:
21+
- !GetAtt AwsLambdaPowertoolsPythonLayer.Outputs.LayerVersionArn
2022
Tracing: Active # enables X-Ray tracing
2123
Environment:
2224
Variables:
@@ -33,6 +35,13 @@ Resources:
3335
Path: /hello
3436
Method: get
3537

38+
AwsLambdaPowertoolsPythonLayer:
39+
Type: AWS::Serverless::Application
40+
Properties:
41+
Location:
42+
ApplicationId: arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer
43+
SemanticVersion: 1.3.1 # change to latest semantic version available in SAR
44+
3645
Outputs:
3746
# ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
3847
# Find out more about other implicit resources you can reference within SAM

0 commit comments

Comments
 (0)