π‘οΈ AWS Lambda Function is not in multiple Availability Zonesπ’
- Contextual name: π‘οΈ Function is not in multiple Availability Zonesπ’
- ID:
/ce/ca/aws/lambda/function-multi-az - Tags:
- π’ Policy with categories
- π’ Policy with type
- π’ Production policy
- Policy Type:
COMPLIANCE_POLICY - Policy Categories:
RELIABILITY
Logicβ
- π§ prod.logic.yamlπ’
Similar Policiesβ
Descriptionβ
Descriptionβ
This policy identifies AWS Lambda Functions that are not configured to use subnets across multiple Availability Zones (AZs). When a Lambda function is connected to a Virtual Private Cloud (VPC), it depends on the VPCβs networking infrastructure. To ensure high availability, the function should be able to fail over to another AZ in the event of a zonal outage.
Rationaleβ
If a Lambda function is configured to use subnets in only a single AZ, any disruption affecting that zone can result in function unavailability. Configuring subnets across multiple AZs allows the Lambda service to automatically route execution to an available zone, improving resilience and maintaining application availability.
Auditβ
This policy flags an AWS Lambda Function as
INCOMPLIANTwhen the number of associated AWS Lambda Function Subnet Links is fewer than two.Lambda functions that are not attached to a VPC are marked as
INAPPLICABLEand are covered by theAWS Lambda Function is not in a VPCpolicy.... see more
Remediationβ
Remediationβ
Configure Lambda Function Subnets Across Multiple AZsβ
Update the Lambda functionβs VPC configuration to include subnets from at least two different Availability Zones. This ensures that the Lambda service can continue executing the function if one AZ becomes unavailable.
From Command Lineβ
Use the
update-function-configurationcommand and specify subnets from multiple AZs in the--vpc-configparameter:aws lambda update-function-configuration \
--function-name {{function-name}} \
--vpc-config SubnetIds=subnet-id1,subnet-id2,SecurityGroupIds=sg-idNotesβ
- Ensure that the specified subnets reside in different Availability Zones.
- Select subnets with network access to required resources such as Amazon RDS, ElastiCache, or internal services.
- Verify that the associated security group allows the necessary inbound and outbound traffic.
- If the function requires outbound internet access, ensure the subnets are configured with a NAT Gateway.