Deploying AWS apps mainly over the AWS homepage takes much time, we can reduce this time a lot by using code-as-infrastructure principles by using the great AWS-CLI and AWS CloudFormation! 🚀
This guide is mainly for beginners which wants a quick & simple overview 🙂 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 git@github.com:TGotwig/devops.git
cd aws-cloudformation/solutions/simple/mean-stack
⚙️ Setup awscli
Install the awscli
from somewhere and login:
aws configure --profile <YOUR_AWS_ACCOUNT_NAME>
You will be asked for two IDs, you can get them through:
⚙️ Setup ssh
Create a file called parameters.json
:
[
{
"ParameterKey": "KeyName",
"ParameterValue": "<KeyName>"
}
]
Replace <KeyName>
by your SSH key under EC2 / Key Pairs
:
⚙️ Setup Makefile
Create a file called .env
for the Makefile
:
stack-name=simple-mean-stack
profile=<YOUR_AWS_ACCOUNT_NAME>
region=YOUR_AWS_REGION
🚀 Run it!
Start it by running make up
, an EC2 machine should boot up:
From that, surf towards http://3.70.190.17
to see it 👀
You can remove the entire stack by running make rm
! 🔥
I really hope you enjoyed this story and wish you happy coding! 🤗🖥
Top comments (4)
Nice read, though I am curious to the possible reasoning for not using ECS or an ECS Optimised AMI?
Hello and thanks tomowatt 🙋♂️🦖
I think I didn't know ECS when I wrote this (almost 1 year ago), what are the advantages of ECS? 🙂
Perhaps I will take a look once my AWS account is reactivated 🤠
Ah okay, that explains - there are too many services on AWS to be honest!
Main advantages of ECS would be the deployment, management and monitoring of Containers, even if they are deployed on EC2 instances.
Though setting up ECS Tasks with CloudFormation is a bit long winded - looking into doing this for a new work project.
With that, using the ECS Optimised AMIs means you don't have to install Docker as it's preinstalled.
Would recommend checking out ecs-cli compose as you can deploy straight from the Compose File to AWS - which is pretty awesome!
Yeahh~ way too many 🙈
Oh cool thank you! 🤩 I think I will take a closer look 🕵️♂️