Skip to content

Latest commit

 

History

History
180 lines (120 loc) · 5.48 KB

README.md

File metadata and controls

180 lines (120 loc) · 5.48 KB

Simple Jobs API built in Node.js and deployed on AWS

GitHub top language GitHub language count GitHub last commit GitHub issues GitHub

About The Project   |    Backend Technologies   |    Backend Getting Started   |    How To Contribute   |    Backend License

👨🏻‍💻 About the project

Project API

This project consists of a simple API that shows some fictional jobs, but the main purpose was to create it to deploy to AWS for learning purposes with the cloud platform, where an EC2 instance was created and an application was uploaded Node.js which is the API itself within a Docker image and finally expose this API on the internet publicly.

🚀 Backend Technologies

Technologies that I used to develop this api

💻 Backend getting started

Requirements

Clone the project and access the folder

$ git clone https://github.com/eltonlazzarin/nodejs-aws-deploy.git

$ cd nodejs-aws-deploy

Follow the steps below

# Install the dependencies
$ yarn

💻 Run API Locally

Creating Docker environment with Node.js

# Create docker enviroment
$ docker-compose up

Run the API

# Run the API
$ yarn start

Acccess the API

http://localhost:3000

💻 Deploy API on AWS

Generating AWS account permissions

$ aws configure

# AWS Console -> AWS User -> My Security Credentials -> AWS IAM credential and click Create access key button and then copy Access key ID and paste bellow
AWS Access Key ID [***************CTPA]:

AWS Access User

AWS Create Access Key

Create an EC2 instance on AWS

$ docker-machine create --driver amazonec2 INSTANCE_NAME

Connect the terminal to EC2 instance

$ eval $(docker-machine env INSTANCE_NAME)

Create docker image in EC2 instance

$ docker-compose up -d

Expose port 3000 on AWS

EC2 -> Security Groups -> Select docker-machine -> Inbound -> Edit -> Add Rule -> Type: Custom TCP Rule -> Protocol: TCP -> Port Range: 3000 -> Source: Custom -> 0.0.0.0/0 -> Save

Console AWS EC2

AWS Expose Port

Access your API

EC2 -> Instances -> Select your instance -> Copy and paste Public DNS (IPv4) on your web browser followed by the port, like http://ec2-3-89-91-138.compute-1.amazonaws.com:3000

Access API Via Web Browser

Disconnect terminal to EC2 instance

$ eval $(docker-machine env INSTANCE_NAME -u)

🤔 How to contribute backend

Follow the steps below

# Clone your fork
$ git clone https://github.com/eltonlazzarin/nodejs-aws-deploy.git

$ cd nodejs-aws-deploy

# Create a branch with your feature
$ git checkout -b your-feature

# Make the commit with your changes
$ git commit -m 'feat: Your new feature'

# Send the code to your remote branch
$ git push origin your-feature

After your pull request is merged, you can delete your branch

📝 Backend License

This project is under the MIT license. See the LICENSE for more information.


Made with ♥ by Elton Lazzarin 👋 Get in touch!