Skip to content

jamesdmorgan/ec2-boto3-provision

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

ec2-boto3-provision

Provision ec2 on-demand or spot instances with python boto3

History

This script was created as I need to migrate a number of boxes from one AWS account to another in a very short time frame. I would have used Ansible but we were limited to pre 2.0 version that didn't support SSO Saml authentication (a requirement of the destination account)

There are a number of other approaches which could be a better solution.

  • Terraform
  • Cloudformation
  • Ansible (needs v2.0+ for SAML)

See Terraform vs Ansible vs Cloudformation

This script reads a simple YAML file containing security group and instance definitions and provisions and tags them.

Authentication

The script assumes you have authenticated with aws and have a local .aws/credentials file

Running the script

$ python2.7 ec2_provision.py --help
usage: ec2_provision.py [-h] [--verbose] [--profile PROFILE] --definitions
                    DEFINITIONS [--add_security_groups] [--add_instances]

EC2 Utilities to manage security groups and instances

    optional arguments:
      -h, --help            show this help message and exit
      --verbose, -v         Verbose Logging
      --profile PROFILE, -p PROFILE

                            EC2 Authentication profile (.aws/credentials)

      --definitions DEFINITIONS, -d DEFINITIONS

                            YAML defintion file with security groups and instances

      --add_security_groups
                            Add security groups
      --add_instances       Add instances

About

Provision ec2 on-demand or spot instances with python boto3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages