Terraform Module: Save files from EC2 before a termination event
Cloud misconfigurations cost companies almost $5 trillion.
(You can read the blog post that describes the whole solution)
Because most of the time, misconfiguration and bad behavior aren't detected soon.
Fortunately, you can resolve the problem:
Identify crucial files in your server that could tell you what happened when the server crashed, and save them before you lose them along with the server.
You have the right solution in front of you. You will never lose files on the server again! Designed by our Cloud Specialist and tested in several scenarios.
Which resources will be charged by AWS?
The whole solution is very cheap and well designed. It will cost you only a few cents monthly and give you immeasurable ROI.
1 - Lambda Function:
The lambda function is the cheapest computing resource available on AWS because it doesn't require a server to execute a task that we would need a computer running 100% of the time.
You will be charged each time that lambda is triggered.
2 - Simple Storage Service (S3):
All files are backup in S3. You will be charged for the amount of GB used for this bucket. Also, the Terraform Module will deploy a Lifecycle to delete objects after specific days (default is 7).
3 - AWS EventBridge:
It's a very cheap service, where millions of events only will cost a few cents.
Understand our solution:
Requirements for Usage:
- Use AWS Cloud Provider
- API Access on your AWS Account.
- Enough privileges to deploy all resources in your region of choice.
- You should have the Terraform installed on your computer or in your pipeline.
- Existing Auto Scaling Group
- Existing IAM Role attached to your instances within the existing Auto Scaling Group.
- AWS System Manager Agent running on your server.
Automatically trigger events that will:
Save necessary logs from any server: choose which files are crucial to troubleshooting the root cause that forced the server to be replaced.
Receive notifications when a new event occurs.
You can create a list of each engineer that needs to be aware when the server is down.
You don't need to do the whole solution from scratch!
The Terraform Module was created to make your life easier. Also, you can change and add new features or resources effortlessly.
The Terraform files are commented on, so you know which purpose for each line and function.
Easy to Deploy
Pretty straightforward Terraform Module, with only 2 inputs to deploy the whole solution in seconds.