Skip to main content

Quickly launch an EC2 instance for small tasks

Project description

ec2instance

ec2instance is the "docker run -it" of AWS EC2. It is a single command that very quickly launches an EC2 instance from the CLI and takes care of the legwork to make it immediately usable for you.

Demo

asciicast

Install

pip install ec2instance

Usage

usage: ec2instance [-h] [-t INSTANCE_TYPE] [-i AMI_IDENTIFIER] [-f USER_DATA_FILENAME]
                   [--volume-size VOLUME_SIZE] [--profile PROFILE_NAME] [--region AWS_REGION]
                   [--non-interactive] [--show-data-path]

Quickly launch an EC2 instance for small tasks. The instance's lifecycle is tied to the process,
enabling easy Ctrl+C instance termination when done.

optional arguments:
  -h, --help            show this help message and exit
  -t INSTANCE_TYPE, --type INSTANCE_TYPE
                        EC2 instance type. (default: t3a.micro)
  -i AMI_IDENTIFIER, --ami AMI_IDENTIFIER
                        EC2 AMI id. You may also pass "ubuntu" as a shortcut to get the latest
                        Ubuntu LTS, or "amazonlinux" as a shortcut to get the latest Amazon Linux.
                        (default: ubuntu)
  -f USER_DATA_FILENAME, --user-data USER_DATA_FILENAME
                        EC2 user data. Path to a shell script. AWS will upload and run this script
                        on the instance immediately after launch. (default:
                        /home/john/.config/ec2instance_cmd/user_data_scripts/default.sh)
  --volume-size VOLUME_SIZE
                        Root EBS volume size (GiB).
  --profile PROFILE_NAME
                        AWS credentials profile name to use.
  --region AWS_REGION   Specific AWS region to use.
  --non-interactive     By default a shell will be opened in the spawned instance, and the
                        instance will be terminated when the shell is closed. To instead output
                        ec2 metadata as json and then exit, specify --non-interactive.
  --show-data-path      Print out the path where ec2instance is storing local data and
                        configuration.

help & support:
  https://github.com/personalcomputer/ec2instance/issues

Notes

  • Before using ec2instance, you must configure AdministratorAccess-level AWS authentication credentials locally:
    • 1.) install awscli
    • 2.) Run aws configure and enter in your AWS access key. How to get an AWS access key is not in scope of this guide.
  • Upon running ec2instance for the first time, it will tell you it is automatically creating a tiny sandbox in your AWS account to ensure that there are no possible conflicts or security concerns from using ec2instance. This sandbox consists of generating a dedicated fresh VPC and SSH keypair, and these are persisted between invocations of ec2instance. There is no AWS fee associated with these resources, and their auto-generated names are obvious and logged to console. Feel free to delete them if you stop using ec2instance.

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

ec2instance-1.3.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

ec2instance-1.3-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file ec2instance-1.3.tar.gz.

File metadata

  • Download URL: ec2instance-1.3.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for ec2instance-1.3.tar.gz
Algorithm Hash digest
SHA256 540686da03cc48f774f1d3454055ff30c93b7459657cb1e0193bba848b771cce
MD5 806bc940eb23f3707220ce9b0e724c03
BLAKE2b-256 83f8b4d042ca3192fdc985356b21a3f9bbc5cea655ceebb976fe232e92ebc6d6

See more details on using hashes here.

File details

Details for the file ec2instance-1.3-py3-none-any.whl.

File metadata

  • Download URL: ec2instance-1.3-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for ec2instance-1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ce4cbbd81f14fcadb8b694e909af3e52744e056f5400efa7729ae85fc90a135a
MD5 7fd1b49e3af9d36e792f87ef7db18e12
BLAKE2b-256 5ec2b42061eb2ae28c15bf45944f7a82e176b4053ee2a1b4a70f2f237f27ceb8

See more details on using hashes here.

Supported by

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