Skip to main content

EC2 Manager

Publish Package

A python wrapper around a terraform ec2 deployment. It awaits instances till their done initializing and allows the user more control over updating or not updating particular instances. It also streamlines project setup and deployments with GitHub workflows.

Dependencies

  • Terraform The python package deploys a terraform module.
  • AWS CLI Boto3 commands check the instance status and send it ssm commands.
  • GitHub The deployment updates based on a GitHub repo.
  • Docker Centered around docker deployments, but it is not a requirement.
  • Python The tool is written is python.

Installation

You can install this package with pip by running the command below.

pip install ec2-manager

Usage

Here is a basic example of

  1. Setup your project and make sure to check it into GitHub
    ec2-manger init
    
    This will setup your repo with a template and a config that looks like this:

    config.yaml

    # globals
    type: example
    aws_region: us-east-1
    vpc_name: "Default VPC"
    public_subnet_cidr: "172.31.0.0/20"
    
    # instance configurations
    instances:
      example-instance-1:
        instance_type: t4g.nano
        update: True
        volume_size: 8
        commands:
          start: "docker-compose up --detach"
          stop: "docker-compose down"
        envs:
          EXAMPLE: HelloWorld
        ports:
          - protocol: tcp
            from_port: 80
            to_port: 80
    
  2. Add your secrets to your repo via the prompts
    ec2-manger set-secrets
    
  3. Apply your changes to deploy, or use the workflow in the template to auto deploy on push.
    ec2-manger apply
    

Override

You can subclass ec2-manager to script in any custom steps or additional remote commands.

override.py

import ec2_manager

class CustomManager(ec2_manager.EC2Manager):
    def update(self):
        print('Override!!')
        self.create_instances()
        self.update_repos()
        self.stop()
        self.start()

Then run ec2-manager with the override.py in the working directory and it will use that class instead!

Release files for ec2-manager 0.0.61

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

Source distribution (sdist)

Source distribution for ec2-manager 0.0.61
File Size Uploaded
ec2-manager-0.0.61.tar.gz 17.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ec2-manager 0.0.61
File Interpreter ABI Platform
ec2_manager-0.0.61-py3-none-any.whl Python 3 none any Details

Total release size: 39.2 kB

Release files / ec2-manager-0.0.61.tar.gz

Download URL ec2-manager-0.0.61.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1cc61deb1aecaae398d5325df4c0427d6b9ac0aa4cdb53e78cdcae98b45376c0
BLAKE2b-256 checksum
How to use checksums
8374d55ab0118e2bec9394fbc685a89ac1135b0d55ea9b3685f6dd4de1d10cc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.6

Release files / ec2_manager-0.0.61-py3-none-any.whl

Download URL ec2_manager-0.0.61-py3-none-any.whl
Size 21.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
77dc3e08e0019f46f19f391314453ef79530e1c474f7c1c276d1ca506ce24a45
BLAKE2b-256 checksum
How to use checksums
2285600260caf3a724bbce9cf9bab379d70585203e8252700ac79594cfe3442b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.6

Release history Release notifications | RSS feed

This release

0.0.61 This release

2 release files

0.0.60

2 release files

0.0.59

2 release files

0.0.58

2 release files

0.0.57

2 release files

0.0.56

2 release files

0.0.51

2 release files

0.0.50

2 release files

0.0.49

2 release files

0.0.48

2 release files

0.0.46

2 release files

0.0.45

2 release files

0.0.44

2 release files

0.0.41

2 release files

0.0.40

2 release files

0.0.39

2 release files

0.0.38

2 release files

0.0.37

2 release files

0.0.36

2 release files

0.0.35

2 release files

0.0.34

2 release files

0.0.33

2 release files

0.0.32

2 release files

0.0.31

2 release files

0.0.30

2 release files

0.0.29

2 release files

0.0.28

2 release files

0.0.27

2 release files

0.0.26

2 release files

0.0.25

2 release files

0.0.24

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

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