Skip to main content
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.

Metadata

Release files for secure-ec2 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for secure-ec2 0.0.6
File Size Uploaded
secure_ec2-0.0.6.tar.gz 22.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for secure-ec2 0.0.6
File Interpreter ABI Platform
secure_ec2-0.0.6-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 37.9 kB

Release files / secure_ec2-0.0.6.tar.gz

Download URL secure_ec2-0.0.6.tar.gz
Size 22.5 kB
Tags Source
SHA-256 checksum
How to use checksums
177ac4ae2c9880084734a3f782f232c4a64507835d27ac7e87bb6f696bac8fa6
BLAKE2b-256 checksum
How to use checksums
fbaa01d202cbc1dad6e4c4e11a5d5882110b1c3e89d3a1693afe4795e038413e
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / secure_ec2-0.0.6-py2.py3-none-any.whl

Download URL secure_ec2-0.0.6-py2.py3-none-any.whl
Size 15.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
51dcfb18d817ffc9c3c85141788350ac4544e0639b79242377cc521092543f13
BLAKE2b-256 checksum
How to use checksums
77b2c276c827a3df108aae18842123e55acba91a634f6f33e8d9c164b3fb4f62
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page