Skip to main content

CLI tool that helps you to provision EC2 instances securely

Project description

https://img.shields.io/pypi/v/secure_ec2.svg https://github.com/avishayil/secure_ec2/actions/workflows/test.yml/badge.svg Documentation Status Coverage

CLI tool that helps you to provision EC2 instances securely

TL;DR

$ brew tap avishayil/homebrew-taps && brew install secure-ec2 # Install secure_ec2 via homebrew
§ secure_ec2 config # Generating secure launch configuration
§ secure_ec2 launch # Launching instance(s) according to the generated launch configuration

Usage & Installation

Install via Homebrew

§ brew tap avishayil/homebrew-taps
§ brew install secure-ec2

Install via pip

§ pip install secure_ec2

Usage

§ secure_ec2

  Usage: secure_ec2 [OPTIONS] COMMAND [ARGS]...

    CLI tool that helps you to provision EC2 instances securely

  Options:
    --help  Show this message and exit.

  Commands:
    config
    launch

Configuration

§ secure_ec2 config

  ? What type of OS?
  1) Windows
  2) Linux
  Answer: 1

The first thing that secure_ec2 does is to create a persistent launch configuration per operating system. The current operating systems supported are Windows and Linux, and updates to the launch configuration are being made per operating system. secure_ec2 will later on look for the launch template to launch your instances, but you can also use these templates to launch instances yourself later on. In the configuration phase, the following steps are done behind the scenes:

  • Look for the default VPC and public subnet on the selected operating region.

  • Provision a security group, with open ingress to the computer public IP according to the selected operating system port for future use.

  • Provision a launch template that utilize the VPC, subnet and security group settings

Instance Provisioning

Example for launching a Linux instance with Keypair:

§ secure_ec2 launch

  ? What type of OS?  Linux
  ? How many instances?  1
  ? Keypair  demo-kp
  ? Instance Type  t2.micro

Example for launching a Windows instance with Session Manager access:

§ secure_ec2 launch

  ? What type of OS?  Windows
  ? How many instances?  1
  ? Keypair  None
  ? Instance Type  t2.micro

Command Line Usage:

§ secure_ec2 config -t Linux # Generate launch template for Linux instances
§ secure_ec2 config -t Windows # Generate launch template for Windows instances
§ secure_ec2 launch -t Linux -n 3 -k None -i t2.micro # Provision 3 Linux instance with Session Manager access
§ secure_ec2 launch -t Windows -n 1 -k demo-kp -i t2.micro # Provision a Windows instance with Keypair

CLI Configuration Parameters:

Configuration Parameter

Type

Required

Description

-t –os_type

str

True

Operating system (Linux / Windows)

-n –num_instances

int

True

Number of instances to provision securely

-k –keypair

str

True

Keypair name to launch the instance with

-i –instance_type

str

True

Instance type, affects compute & networking performance

-nc –no_clip

bool

False

Instruct the tool to not copy the SSM url to the clipboard

-p –profile

str

False

AWS profile name to use

-r –region

str

False

AWS region to use

Features

  • Provision EC2 instance with keypair securely

  • Provision EC2 instance without keypair (Session Manager access) securely

Demo

Linux

The following example runs a Linux instance with SSH access using keypair:

Linux Example

Windows

The following example runs a Windows instance with Session Manager access:

Windows Example

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

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

secure_ec2-0.0.6.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

secure_ec2-0.0.6-py2.py3-none-any.whl (15.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file secure_ec2-0.0.6.tar.gz.

File metadata

  • Download URL: secure_ec2-0.0.6.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10

File hashes

Hashes for secure_ec2-0.0.6.tar.gz
Algorithm Hash digest
SHA256 177ac4ae2c9880084734a3f782f232c4a64507835d27ac7e87bb6f696bac8fa6
MD5 c49602beb4447070e677ab952b07d1dd
BLAKE2b-256 fbaa01d202cbc1dad6e4c4e11a5d5882110b1c3e89d3a1693afe4795e038413e

See more details on using hashes here.

File details

Details for the file secure_ec2-0.0.6-py2.py3-none-any.whl.

File metadata

  • Download URL: secure_ec2-0.0.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10

File hashes

Hashes for secure_ec2-0.0.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 51dcfb18d817ffc9c3c85141788350ac4544e0639b79242377cc521092543f13
MD5 6cceb33f00e66d8fac61169291eed2a1
BLAKE2b-256 77b2c276c827a3df108aae18842123e55acba91a634f6f33e8d9c164b3fb4f62

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