An AWS Lambda function is configured to run within private subnets of a custom VPC to securely query an Amazon Aurora database. The function also needs to retrieve database credentials stored as secure strings in AWS Systems Manager Parameter Store. During testing, the Lambda function times out when attempting to retrieve the parameters, though database connectivity works perfectly. A developer confirms that there is no NAT Gateway configured in the VPC.
Which configuration change will resolve the timeout issue while maintaining the current network architecture and database security?
- Establish an interface VPC endpoint for Systems Manager (ssm) within the private subnets, associating a security group that allows inbound HTTPS traffic from the Lambda function's security group.Answer
- BAttach an IAM policy to the Lambda execution role that grants ssm:GetParameters access, which enables the VPC-bound Lambda function to bypass the private subnet's routing table to reach the public Systems Manager service.
- CUpdate the trust relationship policy document of the Lambda execution role to allow the Systems Manager service principal (ssm.amazonaws.com) to assume the role and push parameter values.
- DMigrate the database credentials from Parameter Store to AWS Secrets Manager, as Systems Manager Parameter Store does not support private VPC endpoint connections or secure string encryption.
Answer
Establish an interface VPC endpoint for Systems Manager (ssm) within the private subnets, associating a security group that allows inbound HTTPS traffic from the Lambda function's security group.
The correct answer is to establish an interface VPC endpoint for Systems Manager (ssm) within the private subnets, associating a security group that allows inbound HTTPS traffic from the Lambda function's security group. Since the Lambda function is running in a private subnet with no NAT Gateway, it has no route to the public internet to reach the default Systems Manager endpoint. Creating an interface VPC endpoint places Elastic Network Interfaces (ENIs) with private IP addresses directly in the private subnets. The Lambda function can then access Parameter Store privately over port 443, provided the endpoint's security group allows inbound traffic from the Lambda function's security group.
Step-by-Step Solution
Key Concept
VPC Interface Endpoints (AWS PrivateLink) and Security Group configurations for private AWS service integration.
Estimated Time:2m 30s