Launch Web-Server On AWS using Automation

What is AWS?

AWS compute

How AWS works

What Is Ansible ?

Ansible Working

Ad-hoc Commands

Advantages of Ansible

Ansible’s Features and Capabilities


vars/main.yml     → Variable declaration
template/main.yml Dynamic Files
here main working of the role to be written
handlers/main.yml → tasks that you want to run or to be called when some condition meets → Is used in the role for instruction or as description file of the role for the user to make changes or how to use that role.
we have other folders to but right now knowing about them not required for completing this task
Ansible playbook for running above roles
Address of Conf file of Ansible
Underlines are very important for ansible to be used while using for AWS
->In the above file, we specified the inventory folder as /hosts [which contain all the info required for ansible to connect to a Managed Node] ---->remote_user for telling ansbile to go as a user ec2-user 
-> roles_path= used to specify path for ansible to search for all the roles used inside the playbook in that particular folder
->private_key_file= is specified for ansible so that AWS should grant access to ansible for making changes inside the AWS cloud instance.
Command given below I run in /hosts folder which I passed to ansible as it's inventory folder now use the command to fetch the required file.
chmod +x
chmod +x ec2.ini
Commands need to be run inside the /root folder
export EC2_INI_PATH=path_of_ec2.ini_file
export AWS_ACCESS_KEY_ID="aws_access_key"
export AWS_SECRET_ACCESS_KEY="aws_secret_key"
export AWS_REGION='app-south-1'
chmod 400 <keyaddress/keyname.pem>
For showing error I am running an false playbook
using command
ansible-playbook --ask-vault-pass ec2-test2.yml
chmod +x /hosts/host
ansible-playbook --ask-vault-pass <playbook>




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Abstract / Extract / Inject

Mastering Pandas — Part 2: Pandas Series

Making a weather reporter in just 5 lines of code in python.

How To Use Coverage and Test Reporters With LWC Jest

Sample LCOV HTML Code Coverage Report for Lightning Web Components


GSSoC’21-Is a great start for beginners...

Terraform ternary on collections

2D Shooter: Shield Strength

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ayush Gupta

Ayush Gupta

More from Medium

AWS Lambda to generate SSH Keys (Save $$$$)

Build your own Stock Prediction API Using Fast API

DB migration using AWS DMS Service

Configure Application Auto Scaling to manage Lambda provisioned concurrency on a schedule