Project: Deploy Udagram an Image filtering Application on AWS
Project Overview
This was the second project I completed while undertaking the Udacity cloud developer Nanodegree program sponsored by ALX-T. Udagram is a cloud-based application for uploading, listing, and filtering images. In this project, Node.js/Express, a popular JavaScript framework for networked application development was used to develop the Udagram application. A REST API to issue commands using HTTP, and store data in Amazon Web Services (AWS) Relational Data Service (RDS) and S3 bucket was implemented. Secure authentication sign-on features were also implemented in the codebase and the application deployed to AWS Elastic Beanstalk. Elastic Beanstalk is an orchestration service that allows users to deploy a web application at the touch of a button by spinning up (or provisioning) all of the services that are needed to run the application.
Prerequisites
- AWS account
- AWS CLI
- Git and Github
- Node.js
- Image Filter Starter Code
- Postman
Project steps
In this project, I deployed the full-stack image filtering app Udagram on AWS using the following steps;
- I Setup the node environment by running the following commands;
- ‘npm i’ to install all the project dependencies as specified in the package.json file.
- ‘npm run dev’ to run the dev script specified in the package.json file to start the application server locally.
- Implemented a new restful endpoint in the server.ts file of the project which uses a query parameter to download an image from a public URL, filter the image, and return the result.
- Deployed the Application to Elastic Beanstalk using the following steps;
- Configured AWS CLI using IAM user credentials.
- Attached “AdministratorAccess-AWSElsaticBeanstalk” policy to the IAM user using AWS Management console to give the IAM user full access to use Elastic Beanstalk services.
- Attached “AdministratorAccess” permission to the IAM user to enable the user deploy a load balancer for the application on Elastic Beanstalk, the “AdministratorAccess” policy was removed after deployment.
- Installed Elastic Beanstalk CLI using the command “pip install awsebcli — upgrade — user”.
- Initialized the Elastic Beanstalk application with details such as region of deployment, application name, and keypair using the “eb init” command. This created a new directory in the project named “.elasticbeanstalk”. Within the created directory is a configuration file named config.yml. This yaml file contains the set of instructions Elastic Beanstalk will follow when provisioning the AWS infrastructure and deploying the code.
- The Artifact method of deploying code on Elastic Beanstalk was specified on the config.yml file which allows the code to be built locally and packaged into an Archive.zip file.
- “npm run build” command was used to package the code into a usable format as specified in the package.json file.
- The Elastic Beanstalk environment for the deployment of the application was created using the “eb create” command.
- I then configured the deployed Elastic Beanstalk environment variables on AWS console with the postgres database and s3 bucket details.
- Attached a policy granting access to S3 buckets to the generated Elastic Beanstalk IAM role attached to the deployed elastic beanstalk environment.
- The API endpoint of the newly deployed application was then tested using the Elastic Beanstalk’s endpoint URL with Postman.
- After the project was reviewed and passed all running resources were shut down and deleted.