Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/devenes/python-boto3-api

Python API uses the Flask and Boto3 libraries. It has instance listing, instance start, instance stop, instance create and instance terminate features; It has 5 endpoints communicating with EC2 service on AWS.
https://github.com/devenes/python-boto3-api

amazon-web-services aws aws-ec2 aws-sdk aws-sdk-python boto boto3 boto3-script botocore ec2 ec2-instance-connect flask flask-api flask-application json python

Last synced: 5 days ago
JSON representation

Python API uses the Flask and Boto3 libraries. It has instance listing, instance start, instance stop, instance create and instance terminate features; It has 5 endpoints communicating with EC2 service on AWS.

Awesome Lists containing this project

README

        


Python Boto3 Api

 


Python Boto3 API for AWS


Docker
Python
AWS
Github top language
Github language count
Repository size
License




About   |  
Features   |  
Technologies   |  
Requirements   |  
Starting   |  
License   |  
Author


## :dart: About

Python API uses the Flask and Boto3 libraries. It has instance listing, instance start, instance stop, instance create and instance terminate features; It has 5 endpoints communicating with EC2 service on AWS.

## :sparkles: Features

- [:dart: About](#dart-about)
- [:sparkles: Features](#sparkles-features)
- [:rocket: Technologies](#rocket-technologies)
- [:white_check_mark: Requirements](#white_check_mark-requirements)
- [:checkered_flag: Starting](#checkered_flag-starting)
- [Create Instance ](#create-instance-)
- [List Instances ](#list-instances-)
- [Start Instance ](#start-instance-)
- [Stop Instance ](#stop-instance-)
- [Terminate Instance ](#terminate-instance-)
- [Resources](#resources)
- [:memo: License](#memo-license)

## :rocket: Technologies

The following tools were used in this project:

- [Python](https://www.python.org/)
- [Flask](https://flask.palletsprojects.com/)
- [Boto3](https://boto3.amazonaws.com/)
- [AWS](https://aws.amazon.com/)
- [Docker](https://www.docker.com/)

## :white_check_mark: Requirements

Before starting :checkered_flag:, you need to have [Git](https://git-scm.com) and [Python](https://www.python.org/) installed.

## :checkered_flag: Starting

```bash
# Clone this project
git clone https://github.com/devenes/python-boto3-api

# Access
cd python-boto3-api

# Install dependencies
pip install -r requirements.txt

# Run the project
python app.py

# The server will initialize in the
```

## Create Instance

You send a POST request to the `create` endpoint with the following parameters and it will create Ubuntu EC2 instance. You create your EC2 Instance with the `region_name`, `KeyName` and `SecurityGroupId` parameters you send in the request.

```
http://:/ec2/create
```

| Parameter | Type | Description |
| :---------------------- | :------- | :-------------------- |
| `aws_access_key_id` | `string` | AWS Access Key ID |
| `aws_secret_access_key` | `string` | AWS Secret Access Key |
| `region_name` | `string` | AWS Region Name |
| `KeyName` | `string` | AWS Key Name |
| `SecurityGroupId` | `string` | AWS Security Group ID |

---

## List Instances

You send a GET request to the `list` endpoint by entering the following parameters, then you can list all the instances and their status in your AWS account in the region you specify.

```
http://:/ec2/list
```

| Parameter | Type | Description |
| :---------------------- | :------- | :-------------------- |
| `aws_access_key_id` | `string` | AWS Access Key ID |
| `aws_secret_access_key` | `string` | AWS Secret Access Key |
| `region_name` | `string` | AWS Region Name |

---

## Start Instance

You send a POST request to the `start` endpoint by entering the following parameters, and you can start the instance you specified with `instance_id`, in the region you specified with `region_name` and the status of the instance will be changed to `pending` and then to `running`.

```
http://:/ec2/start
```

| Parameter | Type | Description |
| :---------------------- | :------- | :-------------------- |
| `aws_access_key_id` | `string` | AWS Access Key ID |
| `aws_secret_access_key` | `string` | AWS Secret Access Key |
| `region_name` | `string` | AWS Region Name |
| `instance_id` | `string` | Instance ID Number |

---

## Stop Instance

You send a POST request to the `stop` endpoint by entering the following parameters, and you can stop the instance you specified with `instance_id`, in the region you specified with `region_name` and the status of the instance will be changed to `stopping` and then to `stopped`.

```
http://:/ec2/stop
```

| Parameter | Type | Description |
| :---------------------- | :------- | :-------------------- |
| `aws_access_key_id` | `string` | AWS Access Key ID |
| `aws_secret_access_key` | `string` | AWS Secret Access Key |
| `region_name` | `string` | AWS Region Name |
| `instance_id` | `string` | Instance ID Number |

---

## Terminate Instance

You send a POST request to the `terminate` endpoint by entering the following parameters, and you can terminate the instance you specified with `instance_id`, in the region you specified with `region_name` and the status of the instance will be changed to `shutting-down` and then `terminated`.

```
http://:/ec2/terminate
```

| Parameter | Type | Description |
| :---------------------- | :------- | :-------------------- |
| `aws_access_key_id` | `string` | AWS Access Key ID |
| `aws_secret_access_key` | `string` | AWS Secret Access Key |
| `region_name` | `string` | AWS Region Name |
| `instance_id` | `string` | Instance ID Number |

## Resources

- [AWS](https://aws.amazon.com/)
- [Docker](https://www.docker.com/)
- [Git](https://git-scm.com/)
- [Python](https://www.python.org/)
- [Boto3](https://boto3.amazonaws.com/)

## :memo: License

This project is under license from MIT. For more details, see the [LICENSE](LICENSE.md) file.

Made with :heart: by devenes

 

Back to top