No project description provided
Project description
EC2 Manager
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
- 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
- Add your secrets to your repo via the prompts
ec2-manger set-secrets
- 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!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ec2-manager-0.0.61.tar.gz
(17.6 kB
view hashes)
Built Distribution
Close
Hashes for ec2_manager-0.0.61-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77dc3e08e0019f46f19f391314453ef79530e1c474f7c1c276d1ca506ce24a45 |
|
MD5 | 42b8ed9befcbda2b1bb95ff348e5fbcc |
|
BLAKE2b-256 | 2285600260caf3a724bbce9cf9bab379d70585203e8252700ac79594cfe3442b |