Skip to main content

Simple CLI / module to create/start/stop EC2 instances

Project description

# ec2.py

> Simple CLI / module to create/start/stop EC2 instances

Pypi Link: https://pypi.python.org/pypi/ec2.py

Features:

  • Single command creation of security key and instance

  • Idempotent, repeated calls do not result in multiple instances

  • Waits for AWS task to complete and provides confirmation.

Supports:

  • AWS Profiles

  • Instance type specification

  • Key generation

  • Start/stop/terminate Instances

## Notes

By design, the application binds instance creation to a key file (custom name can be specified). This allows enhanced security around managing the life cycle of an instance, but requires creation of more than one keyfile for multiple instances.

## Installation

  • Install:
    • pip install ec2.py –upgrade

## Setup

## Usage

  • ec2 - Creates a new AWS instance of t2.nano, and a new Key ec2.py if either do not exist. If these already exist, will start the instance if stopped.

  • ec2 -s - Stop the instance. If one does not exist, will create a key and new instance.

  • ec2 -r - Remove the instance (terminates) and delete the key.

  • ec2 -i - Print the public dns name. Allows calling from another bash script.

  • ec2 -i -v - Print the instance type, ami image, public ip address, public dns name.

  • ec2 -p myProfile -k myKey -t t2.medium - Use a custom profile, key name and instance type.

  • ec2 -h - Help

## Developer Setup

  • Install VirtualEnvWrapper
    • sudo pip install virtualenvwrapper –upgrade

    • echo “source /usr/local/bin/virtualenvwrapper.sh” >> ~/.bashrc”

  • Create / switch to Virtual Env
    • mkvirtualenv ec2 or workon ec2

  • Setup
    • make setup

## AMI Info

  • AMI used: amzn-ami-hvm-2016.03.3.x86_64-gp2 (ami-6869aa05)

  • Selected based on compatability with AWS Lambda environment

## Articles

## Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ec2.py-0.1.3.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ec2.py-0.1.3-py2-none-any.whl (7.7 kB view details)

Uploaded Python 2

File details

Details for the file ec2.py-0.1.3.tar.gz.

File metadata

  • Download URL: ec2.py-0.1.3.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ec2.py-0.1.3.tar.gz
Algorithm Hash digest
SHA256 2ca7cf902391867a5898956107a7f008d38197ceac09bccd3705d54c837a2f39
MD5 57a1a238aed4c2302ec75aa4921ac13e
BLAKE2b-256 5d257aaa14389900ad24d72ac8d230063ecf68df2f43376fcf0387a42b7d0ae5

See more details on using hashes here.

File details

Details for the file ec2.py-0.1.3-py2-none-any.whl.

File metadata

File hashes

Hashes for ec2.py-0.1.3-py2-none-any.whl
Algorithm Hash digest
SHA256 77d070ef9844c751dc5043af037f256c7adbb65fb52ae77dffd8ae850d04af07
MD5 2a37f30f8c9274b28f6b89d3c2a5913c
BLAKE2b-256 05eda4c7916952a462e1e8150742ac5db0b6bd69a8579dfb8e029faba79f2b62

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page