Web Server on AWS through Ansible

Integration of AWS & Ansible

Here we will use the concept of dynamic inventory so that in one click we will launch an AWS instance and for configuration purpose it will dynamically put that instance public IP Address into the ansible inventory.

boto

boto3

ec2.py

ec2.ini

🔅Setup ec2.py & ec2.ini just by downloading them & giving path of ec2.py in ansible.cfg because they are capable to detect the IP of all the running instances from our AWS Account.

We also export our AWS_ACCESS_KEY & AWS_SECRET_KEY in Base OS.

Run ansible all --list-hosts after setup to get output

🔅Provision EC2 instance through ansible & here we are using vault to store AWS Access Key & AWS Secret Key.

ec2.yml

🔅Configure the web server through ansible

Step by step execution :

No instance running over AWS.

Test ansible inventory

Run Playbook to launch an AWS Instance & print their public IP.

ec2.yml

Check running instances using ansible command & then verify it from EC2 Dashboard of AWS Console.

Now its time to configure webserver on that instance using Ansible Playbook.

web.yml

Web Page that we will deploy on Webserver.

index.html

Run web.yml to configure that instance.

Test the webserver from terminal using curl command.

Thank you so much for reading !!!!!!!

GitHub Repo URL : Click Here

--

--

--

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

Recommended from Medium

Think About Outcomes

Python “tricks” I can not live without

.NET Top NuGet Packages Every Developer Should Know In 2022

Testing the Resilience of your Kubernetes systems using Chaos Mesh

Visualizing Recursion

Designing Web APIs using Google Firebase Functions: Achieving True Routing

Laiye Automation Challenge July 2021

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
Ashwani Singh

Ashwani Singh

More from Medium

AWS EC2 SSH not working

Installing Apache while starting up an EC2 Instance

Using AWS CLI to create an EC2 instance with an Apache Webserver

AWS S3 — The Basics.