Skip to content

Latest commit

 

History

History
22 lines (17 loc) · 1.12 KB

README.md

File metadata and controls

22 lines (17 loc) · 1.12 KB

aws-ecs-automation

Script for automating the process of creating a ec2 instance with ecs container to run a small task on different instances

How to use:

  • Add the following configuration details in conf:

    • ACCESS_KEY and SECRET_KEY: AWS credentials
    • KEY: name of the pem file
    • REGION: ec2 instance region
    • INSTANCE_TYPE: instance flavor (eg. t2.small, t3.medium, etc.)
    • LAUNCH_TYPE: EC2 or Fargate
    • VPC and SUBNET for the ec2 instance
  • Run parsers.py

python3 parsers.py --aws <instance_type> --docker <docker_image> --entrypoint_args <args for docker entrypoint>
  • Voilà! an ECS cluster is created using a randomized cluster name. This cluster creates a ec2 instance of the specified instance flavour. A docker is deployed on the instance using the docker compose file generated by parsers.py.

  • After 60 secs, the instance is terminated and the cluster is deleted. If you want to delay the process of cleanup you can increase the sleep time in create_ec2_instance.sh or you can comment out the cleanup function in case you don't want to run the cleanup process.