Why in this tutorial VPC creates NAT gateways
Hi All! Im following this tutorial - https://aws.amazon.com/blogs/containers/building-http-api-based-services-using-aws-fargate/
It creates NAT gateways which I don't need (the endpoints still work when NATs were deleted). How can I prevent AWS to spin them up when using CDK?
Thanks,
In the cdk vpc constructor there are a lot of options to customise the default configuration. It is definitely possible to create without nat gateways you can supploy a subnet configuration so only private subnets are created.
eg - will create 1 private isolated subnet in each AZ and no nat gateways as there are no public subnets
new ec2.Vpc(this, 'VPC', {
subnetConfiguration: [
{
cidrMask: 24,
name: 'private',
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
}
]
});
Keep in mind without nat gateways your vpc will not have default outbound internet access and therefore resources cannot reach Public AWS Service Endpoints ie the fargate tasks in this blog will not be able to post cloudwatch logs unless you additionally add a cloudwatch logs vpc endpoint to the vpc.
Relevant questions
Can Managed Compute Enviroments make use of PrivateLink ECS and ECR
asked 2 years agoConverting NAT gateway to NAT instance to save cost
Accepted Answerasked 17 days agoAccess AWS Athena from lambda function in a VPC
asked 3 years agoAccessing AWS Cloud Map from a Lambda in a VPC
asked 2 months agoWhy in this tutorial VPC creates NAT gateways
Accepted Answerasked 3 months agocreate a gallery of video
asked 4 months agoNAT Gateway Traffic Capture for a Specific IP.
asked a month agoSageMaker Studio projects in VpcOnly mode without internet access
Accepted Answerasked a year agoNAT instance - port/IP forwarding
asked 3 months agoNAT Gateway w/ Elastic IP in Public + Private VPC with AWS Workspaces ..
asked 2 years ago