- Description: This API takes URL as input to download and store images to S3 bucket
- Language: Python Flask
- Platform: Docker & AWS (ECS, Fargate, Cloudformation, RDS, IAM, VPC and S3)
- Author: Bhargav Amin
- Step 1: Setup infrastructure from
infrastructure
dir. - Step 2: Run and Deploy APP
Refer infrastructure/README.md
for setup and deployment details.
Defination
GET /list
Response
200 OK
on success204 No Content
on no files found in S3 bucket403 Forbidden error
on issue with S3 bucket permissions or no bucket found
Defination
POST /
Arguments
"url":string
image url
Request Send request as raw json. For eg.
{
"url": "https://example.com/demo.jpg"
}
Response
200 OK
on success400 BAD REQUEST
on invalid url404 NOT FOUND
on image format matched500 Internal Server Error
on database connection failure
Defination
GET /
Response
200 OK
on success
Defination
GET /ping
Response
200 OK
on success
Build and test application in docker locally.
For app directory execute following commands:
- To build app:
docker-compose build
- To run app:
docker-compose up
Command to list docker images:
docker images
Command to run docker image:
docker run -p 80:80 --name=api -d api_image_to_s3
Command to login to container:
docker exec -it <container id> /bin/bash
Command to view container logs:
docker container logs <container id>