About The Project | Backend Technologies | Backend Getting Started | How To Contribute | Backend License
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.
Technologies that I used to develop this api
- Node.js
- Express
- VS Code with EditorConfig and Prettier RC
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
Creating Docker environment with Node.js
# Create docker enviroment
$ docker-compose up
Run the API
# Run the API
$ yarn start
Acccess the API
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]:
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
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
Disconnect terminal to EC2 instance
$ eval $(docker-machine env INSTANCE_NAME -u)
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
This project is under the MIT license. See the LICENSE for more information.
Made with ♥ by Elton Lazzarin 👋 Get in touch!