Skip to content

Commit 3c2c9f2

Browse files
committed
2 parents 62bbe5d + afca609 commit 3c2c9f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+760
-383
lines changed

doc_source/API_CreateEventSourceMapping.md

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ The maximum number of records in each batch that Lambda pulls from your stream o
8484
+ **Amazon Simple Queue Service** \- Default 10\. For standard queues the max is 10,000\. For FIFO queues the max is 10\.
8585
+ **Amazon Managed Streaming for Apache Kafka** \- Default 100\. Max 10,000\.
8686
+ **Self\-Managed Apache Kafka** \- Default 100\. Max 10,000\.
87+
+ **Amazon MQ \(ActiveMQ and RabbitMQ\)** \- Default 100\. Max 10,000\.
8788
Type: Integer
8889
Valid Range: Minimum value of 1\. Maximum value of 10000\.
8990
Required: No

doc_source/API_CreateFunction.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ The request does not use any URI parameters\.
8686
The request accepts the following data in JSON format\.
8787

8888
** [ Architectures ](#API_CreateFunction_RequestSyntax) ** <a name="SSS-CreateFunction-request-Architectures"></a>
89-
The instruction set architecture that the function supports\. Enter a string array with one of the valid values\. The default value is `x86_64`\.
89+
The instruction set architecture that the function supports\. Enter a string array with one of the valid values \(arm64 or x86\_64\)\. The default value is `x86_64`\.
9090
Type: Array of strings
9191
Array Members: Fixed number of 1 item\.
9292
Valid Values:` x86_64 | arm64`

doc_source/API_Invoke.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ Pattern: `(|[a-zA-Z0-9$_-]+)`
6565
The request accepts the following binary data\.
6666

6767
** [ Payload ](#API_Invoke_RequestSyntax) ** <a name="SSS-Invoke-request-Payload"></a>
68-
The JSON that you want to provide to your Lambda function as input\.
68+
The JSON that you want to provide to your Lambda function as input\.
69+
You can enter the JSON directly\. For example, `--payload '{ "key": "value" }'`\. You can also specify a file path\. For example, `--payload file://payload.json`\.
6970

7071
## Response Syntax<a name="API_Invoke_ResponseSyntax"></a>
7172

doc_source/API_SourceAccessConfiguration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The type of authentication protocol, VPC components, or virtual host for your ev
1212
+ `VPC_SECURITY_GROUP` \- The VPC security group used to manage access to your self\-managed Apache Kafka brokers\.
1313
+ `SASL_SCRAM_256_AUTH` \- The Secrets Manager ARN of your secret key used for SASL SCRAM\-256 authentication of your self\-managed Apache Kafka brokers\.
1414
+ `SASL_SCRAM_512_AUTH` \- The Secrets Manager ARN of your secret key used for SASL SCRAM\-512 authentication of your self\-managed Apache Kafka brokers\.
15-
+ `VIRTUAL_HOST` \- \(Amazon MQ\) The name of the virtual host in your RabbitMQ broker\. Lambda uses this RabbitMQ host as the event source\.
15+
+ `VIRTUAL_HOST` \- \(Amazon MQ\) The name of the virtual host in your RabbitMQ broker\. Lambda uses this RabbitMQ host as the event source\. This property cannot be specified in an UpdateEventSourceMapping API call\.
1616
Type: String
1717
Valid Values:` BASIC_AUTH | VPC_SUBNET | VPC_SECURITY_GROUP | SASL_SCRAM_512_AUTH | SASL_SCRAM_256_AUTH | VIRTUAL_HOST`
1818
Required: No

doc_source/API_UpdateEventSourceMapping.md

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ The maximum number of records in each batch that Lambda pulls from your stream o
7878
+ **Amazon Simple Queue Service** \- Default 10\. For standard queues the max is 10,000\. For FIFO queues the max is 10\.
7979
+ **Amazon Managed Streaming for Apache Kafka** \- Default 100\. Max 10,000\.
8080
+ **Self\-Managed Apache Kafka** \- Default 100\. Max 10,000\.
81+
+ **Amazon MQ \(ActiveMQ and RabbitMQ\)** \- Default 100\. Max 10,000\.
8182
Type: Integer
8283
Valid Range: Minimum value of 1\. Maximum value of 10000\.
8384
Required: No

doc_source/API_UpdateFunctionCode.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Required: Yes
4747
The request accepts the following data in JSON format\.
4848

4949
** [ Architectures ](#API_UpdateFunctionCode_RequestSyntax) ** <a name="SSS-UpdateFunctionCode-request-Architectures"></a>
50-
The instruction set architecture that the function supports\. Enter a string array with one of the valid values\. The default value is `x86_64`\.
50+
The instruction set architecture that the function supports\. Enter a string array with one of the valid values \(arm64 or x86\_64\)\. The default value is `x86_64`\.
5151
Type: Array of strings
5252
Array Members: Fixed number of 1 item\.
5353
Valid Values:` x86_64 | arm64`

doc_source/configuration-envvars.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ Lambda always provides server\-side encryption at rest with an AWS KMS key\. By
217217

218218
If you prefer, you can provide an AWS KMS customer managed key instead\. You might do this to have control over rotation of the KMS key or to meet the requirements of your organization for managing KMS keys\. When you use a customer managed key, only users in your account with access to the KMS key can view or manage environment variables on the function\.
219219

220-
Customer managed keys incur standard AWS KMS charges\. For more information, see [AWS Key Management Service pricing](https://aws.amazon.com/kms/pricing/), in the *AWS KMS produt pages*\.
220+
Customer managed keys incur standard AWS KMS charges\. For more information, see [AWS Key Management Service pricing](https://aws.amazon.com/kms/pricing/), in the *AWS KMS product pages*\.
221221

222222
**Security in transit**
223223
For additional security, you can enable helpers for encryption in transit, which ensures that your environment variables are encrypted client\-side for protection in transit\.

doc_source/configuration-filesystem.md

+58-38
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,27 @@
33
You can configure a function to mount an Amazon Elastic File System \(Amazon EFS\) file system to a local directory\. With Amazon EFS, your function code can access and modify shared resources safely and at high concurrency\.
44

55
**Topics**
6-
+ [Connecting to a file system \(console\)](#configuration-filesystem-config)
7-
+ [Configuring a file system and access point](#configuration-filesystem-setup)
86
+ [Execution role and user permissions](#configuration-filesystem-permissions)
7+
+ [Configuring a file system and access point](#configuration-filesystem-setup)
8+
+ [Connecting to a file system \(console\)](#configuration-filesystem-config)
99
+ [Configuring file system access with the Lambda API](#configuration-filesystem-api)
1010
+ [AWS CloudFormation and AWS SAM](#configuration-filesystem-cloudformation)
1111
+ [Sample applications](#configuration-filesystem-samples)
1212

13-
## Connecting to a file system \(console\)<a name="configuration-filesystem-config"></a>
14-
15-
A function connects to a file system over the local network in a VPC\. The subnets that your function connects to can be the same subnets that contain mount points for your file system, or subnets in the same Availability Zone that can route NFS traffic \(port 2049\) to the file system\.
16-
17-
**Note**
18-
If your function is not already connected to a VPC, see [Configuring a Lambda function to access resources in a VPC](configuration-vpc.md)\.
19-
20-
**To configure file system access**
21-
22-
1. Open the [Functions page](https://console.aws.amazon.com/lambda/home#/functions) on the Lambda console\.
23-
24-
1. Choose a function\.
13+
## Execution role and user permissions<a name="configuration-filesystem-permissions"></a>
2514

26-
1. Choose **Configuration** and then choose **File systems**\.
15+
Lambda uses your function's permissions to mount file systems\. To connect to a file system, your function's execution role must have the following permissions in addition to the [permissions required to connect to the file system's VPC](configuration-vpc.md#vpc-permissions):
2716

28-
1. Under **File system**, choose **Add file system**\.
17+
**Execution role permissions**
18+
+ **elasticfilesystem:ClientMount**
19+
+ **elasticfilesystem:ClientWrite \(not required for read\-only connections\)**
2920

30-
1. Configure the following properties:
31-
+ **EFS file system** – The access point for a file system in the same VPC\.
32-
+ **Local mount path** – The location where the file system is mounted on the Lambda function, starting with `/mnt/`\.
21+
These permissions are included in the **AmazonElasticFileSystemClientReadWriteAccess** managed policy\.
3322

34-
**Pricing**
35-
Amazon EFS charges for storage and throughput, with rates that vary by storage class\. For details, see [Amazon EFS pricing](https://aws.amazon.com/efs/pricing)\.
36-
Lambda charges for data transfer between VPCs\. This only applies if your function's VPC is peered to another VPC with a file system\. The rates are the same as for Amazon EC2 data transfer between VPCs in the same Region\. For details, see [Lambda pricing](https://aws.amazon.com/lambda/pricing)\.
23+
When you configure a file system, Lambda uses your permissions to verify mount targets\. To configure a function to connect to a file system, your IAM user needs the following permissions:
3724

38-
For more information about Lambda's integration with Amazon EFS, see [Using Amazon EFS with Lambda](services-efs.md)\.
25+
**User permissions**
26+
+ **elasticfilesystem:DescribeMountTargets**
3927

4028
## Configuring a file system and access point<a name="configuration-filesystem-setup"></a>
4129

@@ -61,20 +49,32 @@ For more information, see the following topics in the *Amazon Elastic File Syste
6149
+ [Creating resources for Amazon EFS](https://docs.aws.amazon.com/efs/latest/ug/creating-using.html)
6250
+ [Working with users, groups, and permissions](https://docs.aws.amazon.com/efs/latest/ug/accessing-fs-nfs-permissions.html)
6351

64-
## Execution role and user permissions<a name="configuration-filesystem-permissions"></a>
52+
## Connecting to a file system \(console\)<a name="configuration-filesystem-config"></a>
6553

66-
Lambda uses your function's permissions to mount file systems\. To connect to a file system, your function's execution role must have the following permissions in addition to the [permissions required to connect to the file system's VPC](configuration-vpc.md#vpc-permissions):
54+
A function connects to a file system over the local network in a VPC\. The subnets that your function connects to can be the same subnets that contain mount points for your file system, or subnets in the same Availability Zone that can route NFS traffic \(port 2049\) to the file system\.
6755

68-
**Execution role permissions**
69-
+ **elasticfilesystem:ClientMount**
70-
+ **elasticfilesystem:ClientWrite \(not required for read\-only connections\)**
56+
**Note**
57+
If your function is not already connected to a VPC, see [Configuring a Lambda function to access resources in a VPC](configuration-vpc.md)\.
7158

72-
These permissions are included in the **AmazonElasticFileSystemClientReadWriteAccess** managed policy\.
59+
**To configure file system access**
7360

74-
When you configure a file system, Lambda uses your permissions to verify mount targets\. To configure a function to connect to a file system, your IAM user needs the following permissions:
61+
1. Open the [Functions page](https://console.aws.amazon.com/lambda/home#/functions) on the Lambda console\.
7562

76-
**User permissions**
77-
+ **elasticfilesystem:DescribeMountTargets**
63+
1. Choose a function\.
64+
65+
1. Choose **Configuration** and then choose **File systems**\.
66+
67+
1. Under **File system**, choose **Add file system**\.
68+
69+
1. Configure the following properties:
70+
+ **EFS file system** – The access point for a file system in the same VPC\.
71+
+ **Local mount path** – The location where the file system is mounted on the Lambda function, starting with `/mnt/`\.
72+
73+
**Pricing**
74+
Amazon EFS charges for storage and throughput, with rates that vary by storage class\. For details, see [Amazon EFS pricing](https://aws.amazon.com/efs/pricing)\.
75+
Lambda charges for data transfer between VPCs\. This only applies if your function's VPC is peered to another VPC with a file system\. The rates are the same as for Amazon EC2 data transfer between VPCs in the same Region\. For details, see [Lambda pricing](https://aws.amazon.com/lambda/pricing)\.
76+
77+
For more information about Lambda's integration with Amazon EFS, see [Using Amazon EFS with Lambda](services-efs.md)\.
7878

7979
## Configuring file system access with the Lambda API<a name="configuration-filesystem-api"></a>
8080

@@ -130,6 +130,7 @@ You can use AWS CloudFormation and the AWS Serverless Application Model \(AWS SA
130130
**Example template\.yml – File system configuration**
131131

132132
```
133+
Transform: AWS::Serverless-2016-10-31
133134
Resources:
134135
VPC:
135136
Type: AWS::EC2::VPC
@@ -141,20 +142,33 @@ Resources:
141142
VpcId:
142143
Ref: VPC
143144
CidrBlock: 10.0.1.0/24
144-
AvailabilityZone: "eu-central-1a"
145+
AvailabilityZone: "us-west-2a"
145146
EfsSecurityGroup:
146147
Type: AWS::EC2::SecurityGroup
147148
Properties:
148149
VpcId:
149150
Ref: VPC
150151
GroupDescription: "mnt target sg"
151-
SecurityGroupEgress:
152+
SecurityGroupIngress:
152153
- IpProtocol: -1
153154
CidrIp: "0.0.0.0/0"
154155
FileSystem:
155156
Type: AWS::EFS::FileSystem
156157
Properties:
157158
PerformanceMode: generalPurpose
159+
AccessPoint:
160+
Type: AWS::EFS::AccessPoint
161+
Properties:
162+
FileSystemId:
163+
Ref: FileSystem
164+
PosixUser:
165+
Uid: "1001"
166+
Gid: "1001"
167+
RootDirectory:
168+
CreationInfo:
169+
OwnerGid: "1001"
170+
OwnerUid: "1001"
171+
Permissions: "755"
158172
MountTarget1:
159173
Type: AWS::EFS::MountTarget
160174
Properties:
@@ -167,11 +181,17 @@ Resources:
167181
MyFunctionWithEfs:
168182
Type: [AWS::Serverless::Function](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html)
169183
Properties:
170-
CodeUri: function/.
171-
Description: Use a file system.
184+
Handler: index.handler
185+
Runtime: python3.9
186+
VpcConfig:
187+
SecurityGroupIds:
188+
- Ref: EfsSecurityGroup
189+
SubnetIds:
190+
- Ref: Subnet1
172191
FileSystemConfigs:
173-
- Arn: "arn:aws:elasticfilesystem:eu-central-1:123456789101:access-point/fsap-015cxmplb72b405fd"
174-
LocalMountPath: "/mnt/efs0"
192+
- Arn: !GetAtt AccessPoint.Arn
193+
LocalMountPath: "/mnt/efs"
194+
Description: Use a file system.
175195
DependsOn: "MountTarget1"
176196
```
177197

doc_source/configuration-images.md

+49-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ When you deploy code as a container image to a Lambda function, the image underg
3737

3838
## Amazon ECR permissions<a name="configuration-images-permissions"></a>
3939

40-
For your function to access the container image in Amazon ECR, you can add `ecr:BatchGetImage` and `ecr:GetDownloadUrlForLayer` permissions to your Amazon ECR repository\. The following example shows the minimum policy:
40+
For a function in the same account as the container image in Amazon ECR, you can add `ecr:BatchGetImage` and `ecr:GetDownloadUrlForLayer` permissions to your Amazon ECR repository\. The following example shows the minimum policy:
4141

4242
```
4343
{
@@ -59,6 +59,53 @@ If the Amazon ECR repository does not include these permissions, Lambda adds `ec
5959

6060
To view or edit your Amazon ECR repository permissions, follow the directions in [Setting a repository policy statement](https://docs.aws.amazon.com/AmazonECR/latest/userguide/set-repository-policy.html) in the *Amazon Elastic Container Registry User Guide*\.
6161

62+
### Amazon ECR cross\-account permissions<a name="configuration-images-xaccount-permissions"></a>
63+
64+
A different account in the same region can create a function that uses a container image owned by your account\. In the following example, your Amazon ECR repository permissions policy needs the following statements to grant access to account number 123456789012\.
65+
+ **CrossAccountPermission** – Allows account 123456789012 to create and update Lambda functions that use images from this ECR repository\.
66+
+ **LambdaECRImageCrossAccountRetrievalPolicy** – Lambda will eventually set a function's state to inactive if it is not invoked for an extended period\. This statement is required so that Lambda can retrieve the container image for optimization and caching on behalf of the function owned by 123456789012\.
67+
68+
**Example Add cross\-account permission to your repository**
69+
70+
```
71+
{"Version": "2012-10-17",
72+
"Statement": [
73+
{
74+
"Sid": "CrossAccountPermission",
75+
"Effect": "Allow",
76+
"Action": [
77+
"ecr:BatchGetImage",
78+
"ecr:GetDownloadUrlForLayer"
79+
],
80+
"Principal": {
81+
"AWS": "arn:aws:iam::123456789012:root"
82+
}
83+
},
84+
{
85+
"Sid": "LambdaECRImageCrossAccountRetrievalPolicy",
86+
"Effect": "Allow",
87+
"Action": [
88+
"ecr:BatchGetImage",
89+
"ecr:GetDownloadUrlForLayer"
90+
],
91+
"Principal": {
92+
"Service": "lambda.amazonaws.com"
93+
},
94+
"Condition": {
95+
"StringLike": {
96+
"aws:sourceARN":
97+
"arn:aws:lambda:us-east-1:123456789012:function:*"
98+
}
99+
}
100+
}
101+
]
102+
}
103+
```
104+
105+
To give access to multiple accounts, you add the account IDs to the Principal list in the `CrossAccountPermission` policy and to the Condition evaluation list in the `LambdaECRImageCrossAccountRetrievalPolicy`\.
106+
107+
If you are working with multiple accounts in an AWS Organization, we recommend that you enumerate each account ID in the ECR permissions policy\. This approach aligns with the AWS security best practice of setting narrow permissions in IAM policies\.
108+
62109
## Override the container settings<a name="configuration-images-settings"></a>
63110

64111
You can use the Lambda console or the Lambda API to override the following container image settings:
@@ -163,7 +210,7 @@ To create a function defined as container image, use the `create-function` comma
163210
164211
When you create the function, you can specify the instruction set architecture\. The default architecture is `x86-64`\. Make sure that the code in your container image is compatible with the architecture\.
165212
166-
Note that you must create the function from the same account as the container registry in Amazon ECR\.
213+
You can create the function from the same account as the container registry or from a different account in the same region as the container registry in Amazon ECR\. For cross\-account access, adjust the [Amazon ECR permissions](#configuration-images-xaccount-permissions) for the image\.
167214
168215
```
169216
aws lambda create-function --region sa-east-1 --function-name my-function \

0 commit comments

Comments
 (0)