Skip to content

Camilo-J/Backend_ImageUploader

Repository files navigation

Infrastructure for Image Uploader

This project contains the infrastructure for the image uploader. It uses AWS CDK to create the infrastructure.

Infrastructure

The infrastructure consists of the following components:

  • API Gateway: It is used to upload images. The API Gateway has a POST method that triggers a Lambda function to upload the image to an S3 bucket.
  • Lambda Function: It is triggered by the API Gateway to upload the image to an S3 bucket and return an image's url.
  • S3 Bucket: It stores the images uploaded by the users.
  • CloudFront Distribution: It is used to serve the images uploaded by the users.
  • S3 Bucket Policy: It allows the Lambda function to upload the image to the S3 bucket.
  • CloudWatch Logs: It stores the logs of the Lambda function.

Infrastructure

Prerequisites

  • Node.js
  • AWS CLI
  • AWS CDK
  • AWS Account

Installation

  1. Clone the repository

     git clone git@github.com:Camilo-J/Backend_ImageUploader.git
  2. Install the dependencies

    npm install
  3. Deploy the stack to AWS(AWS CLI must be configured)

    cdk deploy
  4. After the deployment, you will see the output of the stack. You will see the URL of the API Gateway. You can use this URL to upload images.

  5. To destroy the stack

    cdk destroy

Usage

To upload an image, you can use the following command:

curl -X POST -F "file=@<path_to_image>" <API_URL>

For example:

curl -X POST -F "file=@./image.jpg" https://<API_ID>.execute-api.<REGION>.amazonaws.com/prod/upload

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

This is the infrastructure for the project image-uploader

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published