4

Load-Balanced MEAN-Stack by AWS CloudFormation & Docker 🐳

 2 years ago
source link: https://dev.to/tgotwig/load-balanced-mean-stack-by-aws-cloudformation-docker-3pj9
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

🐳 MEAN-Stack CloudFormation (2 Part Series)

In this short article I will show how to deploy a Mean-Stack app by AWS-CLI and CloudFormation using a v1 load-balancer 😃

All the code regarding our deployment you can also find here:
https://github.com/TGotwig/devops

We take usage of an very nice and simple MEAN-Stack project which comes from Brad Traversy 🤗

Download the sample repo and cd into it:

git clone [email protected]:TGotwig/devops.git
cd aws-cloudformation/solutions/advanced/mean-stack
Enter fullscreen modeExit fullscreen mode

⚙️ Setup awscli

Install the awscli from somewhere and login:

aws configure --profile <YOUR_AWS_ACCOUNT_NAME>
Enter fullscreen modeExit fullscreen mode

You will be asked for two IDs, you can get them through:

Click on your name at the top right corner and then on  raw `My Security Credentials` endraw

Open the tab  raw `Access keys (access key ID and secret access key)` endraw

⚙️ Setup ssh

Create a file called parameters.json:

[
  {
    "ParameterKey": "KeyName",
    "ParameterValue": "<KeyName>"
  }
]
Enter fullscreen modeExit fullscreen mode

Replace <KeyName> by your SSH key under EC2 / Key Pairs:

Screenshot_2020-10-10 Key pairs EC2 Management Console(1)

⚙️ Setup Makefile

Create a file called .env for the Makefile:

stack-name=simple-mean-stack
profile=<YOUR_AWS_ACCOUNT_NAME>
region=<YOUR_AWS_REGION>
Enter fullscreen modeExit fullscreen mode

🚀 Run it!

Start it by running make up, an EC2 machine should boot up:

After some time we can reach the app, run make getUrl to get the url:

After refreshing the page few times you should see another IP:

You can remove the entire stack by running make rm! 🔥

Awesome! Now we have finished our load-balanced Mean-Stack app 😎🎉


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK