A developer is building a serverless integration service. An AWS Lambda function is configured to run inside a custom VPC to process sensitive data. The function must poll messages from an Amazon SQS queue, store the processed data in an Amazon Aurora PostgreSQL database located in a private database subnet, and send a confirmation payload to an external HTTP webhook API on the public internet.
Which two configurations are required to ensure the Lambda function has the necessary network paths and security settings?
- Configure the Lambda function to run in the private subnets of the VPC, and configure a route in the subnet route tables directing to a NAT Gateway located in a public subnet.Cevap
- Configure the Security Group of the Aurora PostgreSQL database to allow inbound traffic on port from the Security Group associated with the Lambda function.Cevap
- CConfigure the Lambda function to run in public subnets with an assigned public IP address to allow direct outbound access to the external webhook.
- DCreate a Gateway VPC Endpoint for Amazon SQS and associate it with the route tables of the private subnets to allow private polling of SQS messages.
- EModify the IAM trust policy of the Lambda function's execution role to allow the Amazon SQS service to assume the role and push messages directly to the function's execution context.
Cevap
Configure the Lambda function to run in private subnets with a route to a NAT Gateway, and configure the database's Security Group to allow inbound traffic from the Lambda function's Security Group.
To allow the Lambda function to connect to the private database, the database security group must authorize inbound traffic on port from the Lambda function's security group. To allow the function to reach the external HTTP webhook on the public internet, the Lambda function must run in private subnets with a route directing outbound traffic to a NAT Gateway in a public subnet.
Adım Adım Çözüm
Anahtar Kavram
VPC networking configurations for AWS Lambda, including NAT Gateway routing, security groups, and VPC endpoint types.