In general there are two main options to solve your issue:
AWS Lambda: This is a serverless compute service that runs your code in response to events and automatically manages the compute resources for you. If you're new to AWS Lambda, this Getting Started Guide will be helpful.
Amazon EC2: A virtual server where you can run applications on the AWS cloud. EC2 requires more manual setup compared to Lambda but offers more flexibility. Here's a guide on how to launch an EC2 instance.
For most periodic tasks like yours, Lambda is generally more cost-effective and easier to manage.
You can start by checking these workshops and tutorials on AWS Lambda: Workshops & Tutorials
Regarding managing keys and sensitive information:
AWS offers Secrets Manager and Parameter Store (part of Systems Manager) for storing sensitive data:
AWS Secrets Manager: Helps you protect access to your applications, services, and IT resources without the upfront investment. Here's a tutorial.
Systems Manager Parameter Store: Provides secure, hierarchical storage for configuration data management and secrets management. Here's a guide to help you.
You can also find a lot of hands-on labs and tutorials from here: https://github.com/Brain2life/aws-exams-preparation-guide/tree/main/labs
Choose based on your needs; for secrets like API keys, both work well, but Secrets Manager offers more features around rotation and integration with other AWS services.
Based on your requirement, I suggest you to go for ECS deployment of Python script.
- Dockerize the python application. Follow the blog: https://dev.to/francescoxx/dockerize-a-python-application-1olg
- Upload it to Amazon Private ECR(Elastic Container Registry).
- Create ECS(Elastic Container Service) Cluster which runs on AWS Fargate(Serverless) supports tiny to batch workloads, zero maintenance overhead. Follow this tutorial: https://docs.aws.amazon.com/codedeploy/latest/userguide/tutorial-ecs-deployment.html
- Configure an Application Load Balancer to expose the traffic.
- To store the sensitive information, use AWS Secret Manager to store and retrieve the keys & secrets to ECS Cluster. Follow this tutorial: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/specifying-sensitive-data-tutorial.html
Hope this explanation helps, comment here if any thing is needed. Happy to help.!
- asked 4 years ago
- asked 8 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 months ago
- How can I utilize user data to automatically run a script with every restart of my Amazon EC2 Linux instance?AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 8 months ago
- EXPERTpublished 3 months ago