No project description provided
Project description
ec2ctl: Effortless EC2 Instance Control
A lightweight CLI tool to manage AWS EC2 instances by name or group, designed for developers and DevOps who need a faster, more intuitive way to control their instances without repetitive console access.
Table of Contents
- Purpose
- Features
- Installation
- Configuration
- Usage
- Error Handling & Troubleshooting
- Contributing
- License
Purpose
ec2ctl simplifies the management of AWS EC2 instances. It allows you to control instances with intuitive commands based on a local configuration file, eliminating the need for repetitive console access.
Features
- Intuitive Commands:
ec2ctl start dev-server,ec2ctl stop all,ec2ctl status backend-group. - Flexible Configuration: Manage instances by name or group using a simple
config.yamlfile. - Enhanced User Experience: Supports
--dry-run,--verbose, and--yesoptions. - Robust Error Handling: Provides clear messages for AWS authentication, instance state, and configuration issues.
Installation
Prerequisites
- Python 3.7+
pip(Python package installer)- AWS CLI configured with your credentials (
aws configure)
Install ec2ctl
-
Clone the repository:
git clone https://github.com/YOUR_USERNAME/ec2-instance-control.git # Replace with your actual repo URL cd ec2-instance-control
-
Install in editable mode (for development):
pip install -e .
This allows changes to the source code to be immediately reflected without reinstallation.
Configuration
ec2ctl uses a YAML configuration file located at ~/.ec2ctl/config.yaml. You can generate a default configuration file by running:
ec2ctl init
config.yaml Structure
default_profile: default
default_region: ap-northeast-2
instances:
dev-server: i-0abc1234567890
backend-api:
- i-01aaa111aaa
- i-01bbb222bbb
staging: i-0123staging456
default_profile: (Optional) Your default AWS profile name. Defaults todefault.default_region: (Optional) Your default AWS region. Defaults toap-northeast-2.instances: A map of instance names or group names to their corresponding EC2 instance IDs.- Single instance:
dev-server: i-0abc1234567890 - Instance group:
backend-api: [i-01aaa111aaa, i-01bbb222bbb]
- Single instance:
Usage
All commands support --profile, --region, --dry-run, and --verbose options. Commands that modify state also support --yes (-y).
ec2ctl init [--yes]
Initializes the default config.yaml file.
ec2ctl init
# Overwrite without confirmation
ec2ctl init --yes
ec2ctl list
Lists all EC2 instances and groups configured in ~/.ec2ctl/config.yaml.
ec2ctl list
ec2ctl start [name|group]
Starts the specified EC2 instance(s).
ec2ctl start dev-server
ec2ctl start backend-api
ec2ctl stop [name|group]
Stops the specified EC2 instance(s).
ec2ctl stop dev-server
ec2ctl stop backend-api
ec2ctl status [name|group|all]
Gets the current status of the specified EC2 instance(s).
ec2ctl status dev-server
ec2ctl status all
Error Handling & Troubleshooting
ec2ctl provides informative error messages for common issues:
- Config file not found: Run
ec2ctl initto create the default configuration. - Instance/Group not found: Ensure the name is correctly spelled and defined in
config.yaml. - AWS Authentication/Authorization issues: Check your AWS CLI configuration (
aws configure) and IAM policies (e.g.,ec2:StartInstances,ec2:StopInstances,ec2:DescribeInstances). - Incorrect Instance State: Attempting to start an already running instance, or stop an already stopped instance.
Contributing
Contributions are welcome! Please feel free to open issues or submit pull requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ec2ctl-0.1.0.tar.gz.
File metadata
- Download URL: ec2ctl-0.1.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
537d97df39d0e25e5ca6806c3da9477ceaeb0c345e4f1bf0fd7fcf196cd00271
|
|
| MD5 |
aa0ba0f14fec171260cf9f739ab39f13
|
|
| BLAKE2b-256 |
f9b7aea3f8b728f2e70b8c70fa1c3a1d0ec9ab9cd81491304a2528ad5bb2a8aa
|
File details
Details for the file ec2ctl-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ec2ctl-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e89f353e62dfd1920aae91fc604105f8a1a4986e8b16d9ef79c9d0cb2e88c246
|
|
| MD5 |
3264ed87542e91ff1a278b6582f2797e
|
|
| BLAKE2b-256 |
ae0f23032d5e0221a24f261902cd790e31a1dec247ed10863ae22e9fa9b5cbe7
|