aws-samples / serverless-patterns

Serverless patterns. Learn more at the website: https://serverlessland.com/patterns.
https://serverlessland.com
Other
1.59k stars 927 forks source link

[New repo]: Automate the Creation and Deletion of NAT Gateways #2115

Closed awsjosh closed 8 months ago

awsjosh commented 8 months ago

Description

As a best practice, AWS customers should deploy resources that don’t require direct internet access, such as EC2 instances, databases, queues, caching, or other infrastructure, into a VPC private subnet. Those workloads can take advantage of VPC endpoints to call AWS services privately without having to traverse the public internet. Some workloads require occasional updates from external sources. You can use a NAT gateway so instances in a private subnet can connect to services outside your VPC but external services cannot initiate a connection with those instances. Since these updates often occur during a scheduled maintenance window, NAT Gateways aren't necessarily required to be in place all the time, and can be created and deleted only when needed.

This project contains source code and supporting files for a serverless application that allocates an Elastic IP address, creates a NAT Gateway, and adds a route to the NAT Gateway in a VPC route table. The application also deletes the NAT Gateway and releases the Elastic IP address. The process to create and delete a NAT Gateway is orchestrated by an AWS Step Functions State Machine, triggered by an EventBridge Scheduler. The schedule can be defined by parameters during the deployment process.

language

English

runtime

NodeJS

Level

300

Type

Examples

Use case

Backend

Primary image

https://raw.githubusercontent.com/awsjosh/serverless-patterns/awsjosh-feature-create-and-delete-ngw/stepfunctions-create-delete-ngw/docs/CreateNGW.png

IaC framework

AWS SAM

AWS Serverless services used

Description headline

Automate the Creation and Deletion of NAT Gateways with EventBridge Scheduler, Step Functions, Lambda, and SNS

Repo URL

https://github.com/awsjosh/serverless-patterns/tree/awsjosh-feature-create-and-delete-ngw/stepfunctions-create-delete-ngw

Additional resources

https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html https://docs.aws.amazon.com/scheduler/latest/UserGuide/what-is-scheduler.html https://docs.aws.amazon.com/step-functions/latest/dg/welcome.html

Author Name

Josh Rodgers

Author Image URL

https://raw.githubusercontent.com/awsjosh/serverless-patterns/awsjosh-feature-create-and-delete-ngw/stepfunctions-create-delete-ngw/docs/awsjosh.jpg

Author Bio

Josh Rodgers is a Senior Solutions Architect for AWS who works with enterprise customers in the Travel and Hospitality vertical. Josh enjoys working with customers to solve complex problems with a focus on serverless technologies, DevOps, and security. Outside of work, Josh enjoys hiking, playing music, skydiving, painting, and spending time with family.

Author Twitter handle

No response

Author LinkedIn URL

https://www.linkedin.com/in/joshuamrodgers/

leave

No response

jbesw commented 8 months ago

We are no longer accepting repos that are not in aws-samples or aws-labs. Please move your code to one of these AWS-owned OSS repos and resubmit. Sorry for any inconvience as we update our submission guidelines.