Aws and Ansible
What is AWS?
Aws and Ansible
What is AWS?
AWS(Amazon Web Services) is a cloud computing platform.
- AWS allows users to access powerful computing resources, such as servers, storage, databases and many more. Without the need to own or physically operate the infrastructure.
- AWS can be used to host websites and web applications, store data or files and process large sets of data among other things.
- AWS is designed to be highly scalable, flexible and cost-effective so that businesses of all sizes can benefit from cloud computing at affordable pricing.
We can rent computing resources instead of purchasing them. These resources include:
- Servers ( virtual machines like EC2)
- Storage(for files, backups, databases)
- Networking(IP addresses, firewalls, load balancers)
All of this is delivered over the internet. You do not need to know where the physical server is located or how it is maintained. AWS takes full responsibility for the physical security, hardware health, networking infrastructure and data centre operations, while the user focuses only on the OS application and data.
This model is known as cloud computing and AWS follows a pay as you go pricing model. This means you pay only for the resources you actually use for example how many hours a server runs or how much storage you consume instead of paying a fixed cost upfront.
What is Amazon EC2(Elastic Compute Cloud)?
Amazon EC2 (Elastic Compute Cloud) is one of the core services of AWS that provides virtual servers in the cloud. These virtual servers are called EC2 instances. An EC2 instance behaves exactly like a physical computer, but instead of existing in your office or data center, it runs inside AWS’s cloud infrastructure. You can install an operating system, deploy applications, configure networking, attach storage, and control it remotely using secure access methods. The term “Elastic” in EC2 means flexibility. You can quickly increase or decrease computing capacity based on your requirements. This elasticity allows organizations to respond to changes in workload without needing to purchase or maintain additional physical hardware. EC2 enables users to launch servers in minutes rather than weeks or months, which drastically improves development speed and operational efficiency.
Why EC2 Exists?
Before cloud computing, companies had to predict how much computing power they might need in the future. If they underestimated, applications would crash due to lack of resources. If they overestimated, expensive hardware would sit unused. EC2 solves this problem by providing on-demand compute power, allowing businesses to use exactly what they need, when they need it, and stop paying when they no longer need it. EC2 removes the complexity of capacity planning and hardware procurement. Developers and system administrators can focus on applications and services, while AWS handles the underlying physical infrastructure.
What makes Up an EC2 Instance?
An EC2 instance is made up of several key components working together:
- AMI (Amazon Machine Image)
This is the template used to create the instance. It contains the operating system (such as RHEL, Ubuntu, or Windows) and sometimes preinstalled software.
- Instance Type
This defines the hardware configuration of the virtual server, including CPU, memory (RAM), and network performance. For example, small instances are used for testing, while larger ones are used for production workloads.
- Storage (EBS — Elastic Block Store)
Each EC2 instance uses attached storage to hold the operating system and data. This storage persists even if the instance is stopped.
- Networking
EC2 instances run inside a virtual network and can have public or private IP addresses, allowing them to communicate with the internet or other servers.
- Security
Access to EC2 is controlled using key pairs and security groups (firewalls).
Operating Systems on EC2
EC2 supports multiple operating systems, including:
- Red Hat Enterprise Linux (RHEL)
- Amazon Linux
- Ubuntu
- Windows Server
Once launched, the EC2 instance behaves like a normal server. You can:
- Install packages
- Configure users
- Run services
- Host applications
How You Access an EC2 Instance EC2 instances are accessed remotely using SSH (Secure Shell) for Linux-based systems. Instead of a password, AWS uses key-based authentication, which is more secure. A key pair consists of:
- A private key (downloaded by the user)
- A public key (stored by AWS)
- Pay-As-You-Go Model
EC2 follows the AWS pricing model where you pay:
- Per second or per hour
- Based on instance size
- Only while the instance is running
This means you can:
- Start an instance when needed
- Stop it when not needed
- Terminate it completely to avoid costs
- Scalability and Use Cases
EC2 is designed for scalability. Organizations can:
- Run a single server for testing
- Run thousands of servers for large applications
- Automatically scale servers based on traffic
Common use cases include:
- Web servers
- Application servers
- Database servers
- DevOps and automation labs
- CI/CD pipelines
What is RHEL?
RHEL (Red Hat Enterprise Linux) is:
- A commercial Linux OS
- Stable and secure
- Widely used in enterprises
Used for:
- Production servers
- Databases
- Applications
How to Create an EC2 Instance with RHEL
Step 1: Login to AWS Console Go to AWS Management Console
Use your account credentials
Step 2: Go to EC2
Search EC2
Click Launch Instance
Step 3: Choose AMI (Operating System)
Select Red Hat Enterprise Linux (RHEL)
AMI = Template of OS
Step 4: Choose Instance Type
Example:
t2.micro (free tier)
Defines CPU + RAM
Step 5: Create Key Pair
Key pair = login password for server
Download .pem file
Step 7: Launch Instance
Your cloud server is ready
What is SSH?
SSH (Secure Shell) is:
- A secure way to connect to a remote server
- Encrypted communication Think of SSH as: “A safe tunnel to control another computer”
What is Ansible? Ansible is an automation tool. It is used to:
- Install software
- Configure servers
- Manage many machines at once
Instead of doing this manually on 100 servers:
yum install nginx
You do it once, and Ansible does it everywhere.
How Ansible Works
Ansible works on push mechanism.
You push instructions from one machine to others.
What is Ansible Master Node?
Also called:
- Control Node
This is:
- The system where Ansible is installed
- Where you run Ansible commands
Example:
- Your laptop
- One EC2 instance
What is Worker Node?
Also called:
- Managed Node
- Target Node
This is:
- The servers Ansible controls
- EC2 instances, VMs, physical servers
How Ansible Connects (Important)
Ansible uses:
- SSH
- No agent required
- Uses Linux user + key
So:
Master Node → SSH → Worker Nodes 메타데이터
- post_id
- d16d86e9e56d
- slug
- aws-and-ansible-d16d86e9e56d
- url
- https://medium.com/@birendradahal3211/aws-and-ansible-d16d86e9e56d
- canonical_url
- https://medium.com/@birendradahal3211/aws-and-ansible-d16d86e9e56d
- author_url
- https://medium.com/@birendradahal3211
- status
- ok
- fetched_at
- 2026-07-13 06:23:13