You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/functions.md
+43Lines changed: 43 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -529,6 +529,49 @@ The Lambda function execution role must have permissions to create, describe and
529
529
By default, when a Lambda function is executed inside a VPC, it loses internet access and some resources inside AWS may become unavailable. In order for S3 resources and DynamoDB resources to be available for your Lambda function running inside the VPC, a VPC end point needs to be created. For more information please check [VPC Endpoint for Amazon S3](https://aws.amazon.com/blogs/aws/new-vpc-endpoint-for-amazon-s3/).
530
530
In order for other services such as Kinesis streams to be made available, a NAT Gateway needs to be configured inside the subnets that are being used to run the Lambda, for the VPC used to execute the Lambda. For more information, please check [Enable Outgoing Internet Access within VPC](https://medium.com/@philippholly/aws-lambda-enable-outgoing-internet-access-within-vpc-8dd250e11e12)
531
531
532
+
**VPC Lambda Internet IPv6 Access**
533
+
534
+
Alternatively to setting up a NAT Gateway, you can also use an [egress-only internet gateway](https://docs.aws.amazon.com/vpc/latest/userguide/egress-only-internet-gateway.html) and allow your functions in a VPC to access the internet or other AWS services via IPv6. This eliminates the need for a NAT Gateway, reducing costs and simplifying architecture. In this case, VPC-configured Lambda functions can be allowed to access the internet using egress-only internet gateway by adding a `ipv6AllowedForDualStack` option to either the functions VPC specification:
535
+
536
+
```yml
537
+
# serverless.yml
538
+
service: service-name
539
+
provider: aws
540
+
541
+
functions:
542
+
hello:
543
+
handler: handler.hello
544
+
vpc:
545
+
ipv6AllowedForDualStack: true
546
+
securityGroupIds:
547
+
- securityGroupId1
548
+
- securityGroupId2
549
+
subnetIds:
550
+
- subnetId1
551
+
- subnetId2
552
+
```
553
+
554
+
Or if you want to apply VPC configuration to all functions in your service, you can add the configuration to the higher level `provider` object, and overwrite these service level config at the function level. For example:
555
+
556
+
```yml
557
+
# serverless.yml
558
+
service: service-name
559
+
provider:
560
+
name: aws
561
+
vpc:
562
+
ipv6AllowedForDualStack: true
563
+
securityGroupIds:
564
+
- securityGroupId1
565
+
- securityGroupId2
566
+
subnetIds:
567
+
- subnetId1
568
+
- subnetId2
569
+
570
+
functions: ...
571
+
```
572
+
573
+
For more information, please check [Announcing AWS Lambda’s support for Internet Protocol Version 6 (IPv6) for outbound connections in VPC](https://aws.amazon.com/about-aws/whats-new/2023/10/aws-lambda-ipv6-outbound-connections-vpc/)
574
+
532
575
## Environment Variables
533
576
534
577
You can add environment variable configuration to a specific function in `serverless.yml` by adding an `environment` object property in the function configuration. This object should contain a key-value pairs of string to string:
0 commit comments