Escolar Documentos
Profissional Documentos
Cultura Documentos
Introduction .................................................................................................................................................. 2
EC2 Scenarios ................................................................................................................................................ 3
Optimizing costs for virtual servers .............................................................................................................. 5
Notes:
- On AWS, virtual servers are offered by the service called Elastic Compute Cloud ( EC2).
- Provides secure, resizable compute capacity in AWS cloud like virtual compute environment
- By launching instances in separate Availability Zones, you can protect your applications from failure
of a single location
- A stopped virtual server isn’t billed and can be started later. If you terminate a virtual
server, you delete it (difference between stopping and terminating a virtual server)
- Metrics (CPU/Network/Disk Usage) and logs will help you monitor and debug your virtual
servers. Both tools
can help ensure that you’re providing high-quality services
Introduction
Server Virtualization
- A virtual server is part of a physical server that’s isolated by software from other virtual
servers on the same physical server; it consists of CPUs, memory, networking interfaces, and
storage.
- The physical server is also called the host server, and the virtual servers running on it are
called guests.
- A hypervisor is responsible for isolating the guests from each other and for scheduling
requests to the hardware
** There are also instance types and families optimized for compute-intensive workloads,
workloads with high networking I/O, and storage-intensive workloads.
Access Key
- Logging in to your virtual server requires a key. You use a key instead of a password
to authenticate yourself.
- A key is much more secure than a password, and using keys for SSH is enforced for Linux
virtual servers running on AWS
Note:
From Linux machine: chmod 400 mykey.pem , ssh –i mykey.pem ec2-user@ipaddress
Windows only: Putty, Convert .pem file to .ppk using PuttyGen and Load key file to Putty to
login.
EC2 Scenarios
Security groups: virtual firewall which control traffic. Multiple security groups can be associated
- Rules of security group controls inbound and outbound traffic out of instance
- Be default, security group allow NO inbound traffic and allow all outbound traffic
- Security groups are stateful –
- Gives you the ability to scale vertically. If you need more computing power, increase the size
of the server.
- Execute cat /proc/cpuinfo and free -m to gain information about the server’s CPU and
memory.
- You can even change the virtual server’s instance family and version. To increase the size of
your virtual server, you first need to stop
- Post change, your virtual server starts with more CPUs, more memory, and more networking
capabilities. The public and private IP addresses have changed. Grab the new public IP address
to reconnect via SSH
Now, your virtual server can use two CPU cores and offers 7,479 MB of memory
- AWS offers data centers all over the world. To achieve low latency for requests over the
internet, it’s important to choose the closest data center for the majority of your users
- As regions are independent, so you have to create a new key pair for the New region.
- After establishing a SSH session, you can install a default web server by executing
sudo yum install httpd -y. To start the web server, type sudo service httpd start
- You can also connect multiple public IP addresses with a virtual server by using multiple
network interfaces
- To replace VM with elastic IP, execute below steps without interruption.
1 Start a new virtual server B to replace running server A.
2 Install and start applications and all dependencies on virtual server B.
3 Disassociate the Elastic IP from virtual server A, and associate it with virtual
server B.
Requests using the Elastic IP address will now be routed to virtual server B without
interruption.
tasks:
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Gather facts about any instance with a tag key Name and value Example
- ec2_instance_facts:
filters:
"tag:Name": Example