https://github.com/ujjwal-kr/local-ec2
Run an EC2 instance locally using docker (sort of)
https://github.com/ujjwal-kr/local-ec2
Last synced: about 1 month ago
JSON representation
Run an EC2 instance locally using docker (sort of)
- Host: GitHub
- URL: https://github.com/ujjwal-kr/local-ec2
- Owner: ujjwal-kr
- Created: 2024-07-30T13:29:44.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-10-17T22:11:09.000Z (7 months ago)
- Last Synced: 2025-03-26T06:43:13.654Z (about 2 months ago)
- Language: Python
- Homepage:
- Size: 26.4 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Local EC2
Run an EC2-like environment locally using Docker.
## Guide
This guide assumes you have Docker installed and accessible from your command line.
### Setup
1. Clone the repository:
```bash
git clone https://github.com/ujjwal-kr/local-ec2
```2. Navigate to the project directory:
```bash
cd local-ec2
```3. Launch the instance (this may take a few minutes):
```bash
docker compose up --build -d
```4. SSH into the container:
```bash
ssh [email protected] -p 3022
```
Default password: `password`5. To stop the container:
```bash
docker compose down
```
Add the `-v` flag to delete the associated volume on the host.## Usage
This container simulates a remote server environment. You can clone repositories containing backend code and run them inside this virtual server.
To expose ports from your backend:
1. Edit the `EXPOSE` command in the Dockerfile:
```Dockerfile
EXPOSE 22 80 443 [YOUR_PORT]
```2. Add the port to the `ports` directive in the docker-compose.yml file:
```yml
ports:
- "3022:22"
- "80:80"
- "443:443"
- "[HOST_PORT]:[CONTAINER_PORT]"
```It comes with docker pre-installed btw, please use sudo while invoking it.
### Configuration
- The default password for the `ubuntu` user is `password`. You can change this in the Dockerfile.
- Adjust compute limits in the docker-compose.yml file. The current setup mimics a `t2.micro` instance.### API (optional)
This also includes a AWS API if you need it for some reason.
1. Go to api folder by doing `cd ./api`.
1. Install the requirements by running `pip install -r requirements.txt`.
2. Run the API server using `python api.py`.
3. API docs will be released soon.## Roadmap
1. Implement EC2 API compatibility.
- Frontend Interface to do all this.
- SSH via browser because why not.
2. Develop a custom Elastic Kubernetes Service.
3. Render AWS out of business.