Skip to content

DockerEC2Manager provides a secure and easy way to list your AWS EC2 instances using a Docker container. It leverages environment variables for credentials, eliminating the need to store sensitive information within the image. The container is flexible, allowing you to specify the AWS region, and can be further customized with optional features.

Notifications You must be signed in to change notification settings

elliotsecops/DockerEC2Manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

DockerEC2Manager

This project provides a Docker container to list AWS EC2 instances securely using environment variables for credentials. It's suitable for both novice and experienced Docker and AWS users.

Features

  • Security: Avoids storing credentials within the container image by using environment variables.
  • Flexibility: Allows specifying the AWS region when running the container.
  • Simplicity: Easy to build and run.
  • Lightweight: Uses an optimized base image to minimize size.
  • Multi-stage builds (optional): Further reduces the final image size.
  • Health checks (optional): Verifies the container's health.

Requirements

  • Docker installed and running.
  • An AWS account with valid credentials.

Usage

1. Clone the repository:

git clone https://github.com/elliotsecops/DockerEC2Manager.git
cd DockerEC2Manager

2. Build the Docker image:

docker build -t docker-ec2-manager .

3. Run the container:

Replace <YOUR_ACCESS_KEY_ID>, <YOUR_SECRET_ACCESS_KEY>, and <YOUR_SESSION_TOKEN> (if applicable) with your AWS credentials. Replace us-west-2 with your desired region.

docker run --rm \
    -e AWS_ACCESS_KEY_ID=<YOUR_ACCESS_KEY_ID> \
    -e AWS_SECRET_ACCESS_KEY=<YOUR_SECRET_ACCESS_KEY> \
    -e AWS_SESSION_TOKEN=<YOUR_SESSION_TOKEN> \  # Optional, if using temporary authentication
    docker-ec2-manager <region> # Example: us-west-2

For novice users: This command runs the container, lists the EC2 instances in the specified region, and then removes it. Environment variables provide AWS credentials securely without storing them in the image.

For advanced users: You can customize the Dockerfile to use multi-stage builds, health checks, and a requirements.txt file to manage Python dependencies, as described in the "Optional Enhancements" section. You can also explore using more minimalist base images like alpine or distroless.

Optional Enhancements (for advanced users)

The Dockerfile includes options for multi-stage builds and health checks, which are commented out by default. You can uncomment these lines to enable them. You can also use a requirements.txt file to manage Python dependencies. See the Dockerfile for details.

Contributing

Contributions are welcome! Please open a pull request with your changes.

License

MIT

About

DockerEC2Manager provides a secure and easy way to list your AWS EC2 instances using a Docker container. It leverages environment variables for credentials, eliminating the need to store sensitive information within the image. The container is flexible, allowing you to specify the AWS region, and can be further customized with optional features.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published