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 ๐ต๏ธโโ๏ธ