Skip to content

Commit 7cfe939

Browse files
authored
Merge pull request #19 from oss-serverless/revert-17-feature/ipv6-allowed-for-dual-stack
Revert "feat: Add AWS lambda support for IPV6 outbound connections in VPC"
2 parents 316f966 + 790bdf4 commit 7cfe939

File tree

5 files changed

+2
-61
lines changed

5 files changed

+2
-61
lines changed

docs/guides/functions.md

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -529,51 +529,6 @@ The Lambda function execution role must have permissions to create, describe and
529529
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/).
530530
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)
531531

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-
574-
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/)
575-
576-
577532
## Environment Variables
578533

579534
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:

docs/guides/serverless.yml.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,8 @@ Configure the Lambda functions to run inside a VPC ([complete documentation](./f
490490
```yml
491491
provider:
492492
# Optional VPC settings
493-
# If you use VPC then both securityGroupIds and subnetIds are required, ipv6AllowedForDualStack is optional
493+
# If you use VPC then both securityGroupIds and subnetIds are required
494494
vpc:
495-
ipv6AllowedForDualStack: true
496495
securityGroupIds:
497496
- securityGroupId1
498497
- securityGroupId2
@@ -648,7 +647,6 @@ functions:
648647
# If you use VPC then both subproperties (securityGroupIds and subnetIds) are required
649648
# Can be set to '~' to disable the use of a VPC
650649
vpc:
651-
ipv6AllowedForDualStack: true
652650
securityGroupIds:
653651
- securityGroupId1
654652
- securityGroupId2

lib/plugins/aws/deploy-function.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -378,10 +378,6 @@ class AwsDeployFunction {
378378
const vpc = functionObj.vpc || providerObj.vpc;
379379
params.VpcConfig = {};
380380

381-
if (vpc.ipv6AllowedForDualStack) {
382-
params.VpcConfig.Ipv6AllowedForDualStack = vpc.ipv6AllowedForDualStack;
383-
}
384-
385381
if (Array.isArray(vpc.securityGroupIds) && !vpc.securityGroupIds.some(_.isObject)) {
386382
params.VpcConfig.SecurityGroupIds = vpc.securityGroupIds;
387383
}
@@ -391,11 +387,8 @@ class AwsDeployFunction {
391387
}
392388

393389
const didVpcChange = () => {
394-
const remoteConfigToCompare = { Ipv6AllowedForDualStack: false, SecurityGroupIds: [], SubnetIds: [] };
390+
const remoteConfigToCompare = { SecurityGroupIds: [], SubnetIds: [] };
395391
if (remoteFunctionConfiguration.VpcConfig) {
396-
remoteConfigToCompare.Ipv6AllowedForDualStack = new Set(
397-
remoteFunctionConfiguration.VpcConfig.Ipv6AllowedForDualStack || false
398-
);
399392
remoteConfigToCompare.SecurityGroupIds = new Set(
400393
remoteFunctionConfiguration.VpcConfig.SecurityGroupIds || []
401394
);
@@ -404,7 +397,6 @@ class AwsDeployFunction {
404397
);
405398
}
406399
const localConfigToCompare = {
407-
Ipv6AllowedForDualStack: new Set(params.VpcConfig.Ipv6AllowedForDualStack || false),
408400
SecurityGroupIds: new Set(params.VpcConfig.SecurityGroupIds || []),
409401
SubnetIds: new Set(params.VpcConfig.SubnetIds || []),
410402
};

lib/plugins/aws/package/compile/functions.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,6 @@ class AwsCompileFunctions {
389389
if (!this.serverless.service.provider.vpc) this.serverless.service.provider.vpc = {};
390390

391391
functionResource.Properties.VpcConfig = {
392-
Ipv6AllowedForDualStack:
393-
functionObject.vpc.ipv6AllowedForDualStack ||
394-
this.serverless.service.provider.vpc.ipv6AllowedForDualStack,
395392
SecurityGroupIds:
396393
functionObject.vpc.securityGroupIds ||
397394
this.serverless.service.provider.vpc.securityGroupIds,

lib/plugins/aws/provider.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,6 @@ class AwsProvider {
661661
awsLambdaVpcConfig: {
662662
type: 'object',
663663
properties: {
664-
ipv6AllowedForDualStack: { type: 'boolean' },
665664
securityGroupIds: {
666665
anyOf: [
667666
{

0 commit comments

Comments
 (0)