What should a solutions architect do to optimize costs?
Create an additional NAT gateway. Update the route table to route to the NAT gateway. Update the network ACL to allow S3 traffic.
Create an internet gateway. Update the route table to route traffic to the internet gateway. Update the network ACL to allow S3 traffic.
Create a VPC endpoint for Amazon S3. Attach an endpoint policy to the endpoint. Update the route table to direct traffic to the VPC endpoint.
Create an AWS Lambda function outside of the VPC to handle S3 requests. Attach an IAM policy to the EC2 instances, allowing them to invoke the Lambda function.
Explanations:
Creating an additional NAT gateway will not optimize costs. It would increase costs due to the extra NAT gateway, and since S3 traffic does not need to go through a NAT gateway, this option does not address the requirement effectively.
An internet gateway allows direct internet access, which is not suitable for instances in a private subnet. Additionally, S3 traffic can be accessed without routing through an internet gateway, making this option unnecessary and potentially insecure.
Creating a VPC endpoint for Amazon S3 allows EC2 instances in the private subnet to access S3 directly without going through a NAT gateway, significantly reducing costs related to NAT usage and enhancing security by keeping traffic within the AWS network.
While using a Lambda function could facilitate S3 access, it adds unnecessary complexity and potential latency. Moreover, invoking a Lambda function to handle S3 requests does not optimize costs compared to directly accessing S3 through a VPC endpoint.