This Image Upload Service uploads a given image of type jpeg/png with a description to AWS S3 and stores the image metadata to AWS MySQL RDS. The service is extendable to support Db migration as well. It handles all the edge cases and failures and displays user friendly message to the end user.
The service also handles logical inconsistency where it first tries to upload the image to S3, if it is successfully uploaded then it tries to insert the data into RDS. If RDS operation fails, then the uploaded image is deleted from S3 and user is notified that the upload was unsuccessful.
The backend is written in Javascript.
Ensure following dependencies are present before installing the application.
AWS S3bucket for storing the images. Ensure thataccess keyprovided to the application has the permission to doPutObjectandDeleteObjectcommands on the bucket.AWS Mysql RDSversion 5.x or later. Ensure that username and password combination provided to the application has access to connect to the RDS and do create, drop & insert query on it.
- Make sure
node 8.x or higherandnpm 6.xis installed. - Find
deployConfig.jsfile insideconfigfolder and put the bucket name and RDS host indevconfig. Rest details need not be changed.awsBucketName: mysqlDbConfig: { host: port: } - Find
aws-credentialsfile in the project directory and put the following fields in underimage-upload-service-devtag. The fields are self-explanatory.aws_access_key_id = aws_secret_access_key = rds_image_db_user = rds_image_db_password = - Checkout the Project directory in terminal and run
npm install. - Run
npm startafter the npm packages are installed successfully. - The server will start and create the required database and table on its own in the provided
AWS RDS. - Open
127.0.0.1in browser (The Latest Chrome version), and the application will be ready to use. - Application logs can be found inside
logsfolder.
- Make sure
node 8.x or higherandnpm 6.xis installed. - Find
deployConfig.jsfile insideconfigfolder and put the bucket name and RDS host inprodconfig. Rest details need not be changed.awsBucketName: mysqlDbConfig: { host: port: } - Find
aws-credentialsfile in the project directory and put the following fields in underimage-upload-service-prodtag. The fields are self-explanatory.aws_access_key_id = aws_secret_access_key = rds_image_db_user = rds_image_db_password = - Checkout the Project directory in terminal and run
npm install. - Export env variable using command
export NODE_ENV=prod. - Run
npm startafter the npm packages are installed successfully. - The server will start and create the required database and table on its own in the provided
AWS RDS. - Application logs can be found inside
logsfolder.