Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS:EC2:NGINX:SCRIPTS:ANSIBLE #1

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Conversation

TanviSrv
Copy link

No description provided.

TanviSrv added 16 commits July 21, 2020 15:18
# Uploaded a shell script to check if Nginx server hosted on EC2 instance is up and running or not.
# We can also create status check alarm using AWS CLI. 

1. aws cloudwatch list-metrics --namespace AWS/EC2
2. aws cloudwatch put-metric-alarm --alarm-name "StatusCheckFailed-Alarm-for-instance" --alarm-description "The default example alarm" --namespace "AWS/EC2" --metric-name StatusCheckFailed  --statistic Average --period 60 --evaluation-periods 3 --threshold 50 --comparison-operator GreaterThanOrEqualToThreshold --dimensions Name=key1,Value=value1 Name=key2,Value=value2
In this playbook we have one task that has two steps.
a)  The "- name: ...." are only there for the humans, to make sense of the commands. 
     The first step apt: name=nginx state=latest tells the apt module that we want the latest version of the nginx package to be installed. 
b)  The next step tells Linux to make sure the service called nginx is started.
1) Configure Nginx

2) Put it /etc/nginx/sites-available/.

3) Creating a symbolic link from /etc/nginx/sites-enabled/ to that file.

4) Creating a directory where we put the pages of the website. For simplicity we are going to create a static web site. Without an application behind it. Just an HTML file and version.txt file to get the version as text.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant