Aws by Riaz SIR
Aws by Riaz SIR
Aws by Riaz SIR
Reyaz Shaik
By
Reyaz Shaik
www.google.com
Steps to resolving a domain name
1. Web browser and OS will first check whether the domain is in their cache. If yes, done
2. The web browser then will send a request to a DNS resolver. A DNS resolver is a local server with a central
database of DNS nameservers. This DNS resolver will be hosted with your ISP
3. The resolver will first check its cache. If the IP address for google.com isn’t in its cache it will forward the
query recursively up the to the root servers,
4. Down to the Top Level Domain (TLD) of google.com( .com would be the TLD in this case), and then down to
the authoritative name servers responsible for www.google.com.
• But first, it will save this IP to its cache. Caching every step of the way!
• The user’s operating system will also cache this IP address for reference
in the future — in case you want to visit this website again
DNS DONE !! NOW HTTP
• The user’s web browser can now follow HTTP(HyperText Transport Protocol) and send a GET
request to the server at google.com’s corresponding IP address.
1. HTTP is the protocol used to transfer data to and from the website.
2. WWW is the identifier that indicates that it is a web site and it uses the HTTP protocol.
3. HTTP://anything.com, WWW.anything.com, HTTP://WWW.anything.com leads to the same site.
HTTP & TCP
1. Hypertext Transport Protocol (HTTP) is an application layer protocol used for transmitting files/data across
the web through TCP/IP sockets
2. TCP(Transmission Control Protocol) resides in the transport layer and is responsible for creating a reliable
end-to-end connection between two hosts. It’s similar to a messenger.
3. Allows data transfers of other protocols(like HTTP). TCP will break the data down into smaller packets and
then reassemble them at the other end.
Analogy of picking up cookies from grandma’s house
1. IP would be the road on which we drive
2. TCP would be the car
3. And HTTP would be the box of cookies moving from one location to another
TCP/IP
1. HTTP relies on TCP to establish a reliable connection between client and server. Four pieces of information
are needed to establish a TCP connection:
1. Client IP address
2. Client Port number
3. Source IP address
4. Source Port number
An IP address will identify the device, but a port number is also needed to identify the specific
application/service.
It’s similar to having an address to an apartment and a specific unit number.
IP + port number = socket
HTTP protocol uses port 80 as default
SSL (HTTPS)
• Client say Hello
• Server says Hello(do you have certificate? I am SSL)
• Client generated symmetric key
• Server verify the key
• Once verification is successful Secure data transfer
Firewall
1. TCP network breaks data into chunks (packets). Along with data, a packet will have a header including
control information such as source address, destination address, connection state, etc.
2. Protect (a network or system) from unauthorized access with a firewall
Load Balancer, WebServer, Application Server and Database
1. Load Balancer: The job of a load balancer is to…. balance loads.
2. WebServers: Web servers supply the web content for web browsers; what the browser requests, the web
server delivers through Internet network connections.
3. Application servers host and execute applications and can be used to communicate and extract data from a
database
4. Database: A database is a data repository that stores information
Rise 'n' Shine Technologies 1
Common Use Cases for Infrastructure
• Web site / Application hosting
• Mobile and Social Applications
• Internal IT application hosting
• Content delivery and media distribution
• High performance computing, batch data processing, and large scale
analytics
• Storage, backup, and disaster recovery
• Development and test environments
5
Before Virtualization
• Single OS image per machine
• Software and hardware tightly coupled
• Running multiple applications on same machine often creates
conflict
• Underutilized resources
• Inflexible and costly infrastructure
6
After Virtualization
• Hardware-independence of operating system and applications
• Virtual machines can be provisioned to any system
• Can manage OS and application as a single unit by encapsulating
them into virtual machines
7
Virtualization approaches
• Hosted Architecture
Installs and runs as an application
Relies on host OS for device support and physical resource
management
8
• Basic Computer
• Networking
• Security
• Storage
• Data Base
Cloud computing means storing and accessing data and programs over
the Internet instead of your computer's hard drive.
• Cloud Computing can be defined as delivering computing power( CPU, RAM, Network
Speeds, Storage OS software) a service over the internet rather than physically having
the computing resources at the customer location.
Or
• Cloud Computing refers to manipulating, configuring, and accessing the hardware
and software resources remotely. It offers online data storage, infrastructure, and
application.
• Example: AWS, Azure, Google Cloud
•Cost Effective
•Reliability
•Flexibility
•Location Independence
•Utility Style Costing
•High Scalability
DISADVANTAGES
•Low Security
•Less customizable
DISADVANTAGES
•Restricted Area
•Inflexible Pricing
•Limited Scalability
•Additional Skills
•Scalability
•Flexibility
•Cost Efficiencies
DISADVANTAGES
•Networking Issues
•Security Compliance
•Infrastructural
Dependency
•Cost effective
•Sharing Between Organizations
•Security
ISSUES
Amazon EC2
Amazon RDS
Amazon EC2
Amazon EC2
Amazon EC2
Amazon RDS
2) Application Servers
Business
WEB Container
WEB
Container Container
JMS
Container
Apache
Web Server OHS App Server Web Logic
IHS Web Sphere
Nginx
RISE ‘N’ SHINE TECHNOLOGIES Jboss 66
Web Server Application Server
A Web server handles the HTTP protocol. Application Server handles any number of
protocols (HTTP, TCP-IP, RMI (t3) ...etc).
Web Server is mostly designed to serve static The application server is used to run business
content. logic or dynamically generating presentation code.
1) High Availability
2) Fail Over
3) Load Balancing
4) Security
App
WS-1 80
Mc3 - 192.168.1.3 WL-17001
WL-1 7001
Mc1 - 192.168.1.1
DB-1
Intern
DNS Load
et
Balancer WL Cluster
Cisco
Big IP-F5 Plug-in App DB-2
http://192.168.1.1:7001/App http://192.168.1.3:80/App
http://192.168.1.2:7001/App
http://192.168.1.1:7002/App http://192.168.1.4:80/App
RISE ‘N’ SHINE TECHNOLOGIES 69
URLs:
http://192.168.1.1:7001/App
http://192.168.1.2:7001/App
http://192.168.1.3:80/App
http://192.168.1.4:80/App
http://gmail.co.in
By
Reyaz Shaik
3/14
So How many 9's?
4/14
High Availability
• In computing, the term availability is used to describe the period of time when
a service is available, as well as the time required by a system to respond to a
request made by a user.
• In information technology, high availability refers to a system or component
that is continuously operational for a desirably long length of
time. Availability can be measured relative to "100% operational" or "never
failing."
Fault Tolerance
• A good way to think of it is that you have two separate machines that
are mirrored. In the event that the main system has a hardware
failure, the secondary system takes over and there is zero downtime.
• Redundancy
• Monitoring
• Failover
7/14
Failover:
7/14
Rise 'n' Shine Technologies 9
HA vs FT
Hardware Failure P P
OS Level Failure P
Application Failure P
Okay now let’s get ready for some action because you can’t
expect a happy day everyday.
Best part is here users will not experience any downtime of the
system due to the failure of lb1.
735
516
280
159
82
– Foundation services
– Application services
– Administration services
• Administration services: This class deals with all aspects of your AWS
environment, primarily with IAM tools, monitoring your AWS services and
resources, application deployments, and automation.
• Elastic Block Storage (EBS): EBS is a raw block device that can be
attached to your compute EC2 instances to provide them with persistent
storage capabilities.
• Amazon Route 53: Route 53 is a highly scalable and available DNS web
service provided by AWS. Rather than configuring DNS names and
settings for your domain provider, you can leverage Route 53 to do the
heavy lifting work for you.
• Monitoring:
Amazon CloudWatch is a monitoring tool provided by AWS that you
can use to monitor any and all aspects of your AWS environment, from
EC2 instances to your RDS services to the load on your ELBs, and so on.
IAM: AWS provides a rich set of tools and services to secure and control
your infrastructure on the cloud.
• Developer Support:
– This is a paid support service ($49 per month).
– You can create and raise tickets for your support case, which is
generally answered within 12 working hours.
Rise 'n' Shine Technologies 55
Support Plans provided by AWS:
• Business Support:
– This is a paid support service as well and is generally meant for
enterprise-level customers running production workloads on
AWS.
– The SLAs for this support are much higher as a case has to be
answered within an hour from its creation.
• Enterprise Support:
– A paid support service with the highest SLA available (15
minutes);
– these cases are generally handled by a separate team at AWS
called the Technical Account Manager (TAM) who are subject
matter experts in their own fields.
Rise 'n' Shine Technologies 56
Rise 'n' Shine Technologies 57
Rise 'n' Shine Technologies 58
Rise 'n' Shine Technologies 59
Rise 'n' Shine Technologies 60
Rise 'n' Shine Technologies 61
Rise 'n' Shine Technologies 62
Rise 'n' Shine Technologies 63
Rise 'n' Shine Technologies 64
Rise 'n' Shine Technologies 65
Rise 'n' Shine Technologies 66
Rise 'n' Shine Technologies 67
Rise 'n' Shine Technologies 68
AWS Sign Up!!!
Amazon EC2 750 hours per month of Linux and Windows micro instance usage
Next: Permissions
Select Attach Existing Policies
Select any policy name you
required
Next : Tags
Select Attach Existing Policies
Select any policy name you
required
Next : Tags Name & Dev
Review
Create User
Select the created User
and click on it
Assigned MFA Device
Click Manage
Virtual MFA Device
You should have google
authenticator and Barcode Scanner
installed on your phone
Scan using barcode scanner
application from your phone
or
From google authenticator add
account and scan the code
Provide 2 MFA Codes below
Click Assign MFA
• wget https://bootstrap.pypa.io/get-pip.py
• python get-pip.py
• pip install awscli
• aws –version
Managing access and security using the
AWS CLI
• Configuring the AWS CLI
– # aws configure
• you will be prompted to enter the user's Access Key ID and the Secret
Access Key, along with the default region name and the default output
format to use.
• The default region name is a mandatory field and can be any of the
regions from which your users will be operating, for example, us-east-1,
us-west-2, and so on
• The output format accepts any of these three values as the preferred
method to display the output of the commands: table, text, or json.
• Note: Any of these values can be changed at any time by rerunning the
aws configure command.
Accessing CLI Commands
• AWS will store these credentials and configuration
details in two separate files named
~/.aws/credentials and ~/.aws/config, respectively.
• Next, run the following command to attach this policy document to your newly created group:
• # aws iam put-group-policy --group-name SuperUsersGroup --policy-name Admin-Access-All --policy-
document file:///vagrant/myPolicy.json --profile admin
Now I Know AWS CLI !!!!!!
Amazon Elastic Compute Cloud
When your application needs more than 20% of the performance of the CPU, the
CPU enters into a burst mode giving higher performance for a limited amount of
time, therefore work happens faster.
A placement group is basically a logical cluster where some select EC2 instances
which are a part of that group can utilize up to 10Gbps for single flow and 20Gbps
for multi flow traffic in each direction.
Instances which are not a part of that group are limited to 5 Gbps speed in multi flow
traffic. Cluster Networking is ideal for high performance analytics system.
They are perfect for workloads where a corporate policy or industry regulation
requires that your instance should be isolated from any other customer’s instance,
therefore they go for their own separate machines, and their instances are isolated
at the hardware level.
Amazon EC2 uses public–key cryptography to encrypt and decrypt login information.
Public–key cryptography uses a public key to encrypt a piece of data, such as a
password, then the recipient uses the private key to decrypt the data. The public and
private keys are known as a key pair.
AutoScaling
Auto Scaling is a service designed by AWS EC2, which automatically launch or
terminate EC2’s instances based on user defined policies, schedules and health
checks.
• No charge for a period of 12 months from the date of the actual signup
Amazon EC2 750 hours per month of Linux and Windows micro instance usage
On Demand Instances: are used when you want to pay for the hour, with no long
term commitments and upfront payments. They are useful for applications that may
have unpredictable workloads or for test applications that are being deployed for the
first time.
Reserved Instances: provide you with significant discounts as compared to On
Demand Instances. With Reserved Instances you reserve instances for a specific
period of time.
Spot Instances: is a pricing option which enables you to bid on unused EC2
instances. The hourly price for a Spot Instance is set by AWS EC2, and it fluctuates
according to the availability of the instances in a specific Availability zone
!!!!Demo!!!!
Your AWS architecture set-up should include IP ranges for your subnets etc. pre-planned for
better management. (We will see how to create a new VPC in Networking section of the tutorial.
Subnetting should also be pre-planned. E.g.: If it's a web server you should place it in the public
subnet and if it's a DB server, you should place it in a private subnet all inside your VPC.
Below,
Network section will give a list of VPCs available in our platform.
Select an already existing VPC
You can also create a new VPC
Here I have selected an already existing VPC where I want to launch my instance.
•Here we are checking the option for further protecting our instance from accidental termination.
Once you become familiar with the above steps for launching the instance, it becomes a
matter of 2 minutes to launch the same!
You can now use your on-demand EC2 server for your applications.
• Use Security Groups to restrict and filter out both the ingress and egress
traffic of an instance using a set of firewall rules.
• Type field: which specifies the type of application for which you need to
allow access. By default, AWS already has provided a list of common application
types to choose from, which includes SSH, RDP, HTTP, HTTPS, POP3, IMAP,
MySQL, SMTP, and so on so forth. You can additionally create custom TCP/ UDP
application types using this same drop-down list as well.
• Along with the private IP address, you also get an internal DNS hostname for
your instance.
• Running a Windows instance? You can still query its instance metadata by
substituting curl with wget and running the command in your Windows
command prompt.
•
• Optionally, you can even select the Re association checkbox if you wish to re-
allocate an EIP from one attached instance to a new instance.
• Snapshot capabilities:
– The state of an EBS volume can be saved using point-in-time snapshots.
– These snapshots are all stored incrementally on your Amazon S3 account and can be used for a variety
of purposes, such as creating new volumes based on an existing one, resizing volumes, backup and
data recovery, and so on.
• Note:
– EBS volumes cannot be copied from one AWS region to another. In such cases, you can take a
snapshot of the volume and copy the snapshot over to a different region using the steps mentioned at
http://docs.aws.amazon.com/AWSEC2/ latest/UserGuide/ebs-copy-snapshot.html.
• Magnetic volumes:
Rise 'n' Shine Technologies 181
General purpose volumes (SSD):
• Commonly used EBS volume types as they provide a good
balance between cost and overall performance.
• By default, this volume provides a standard 3 IOPS per GB of
storage
• So a 10 GB general purpose volume will get approximately 30
IOPS and so on so forth, with a max value of 10,000 IOPS.
• Range in size from 1 GB to a maximum of 16 TB.
• Such volumes can be used for a variety of purposes, such as
instance root volumes, data disks for dev and test
environments, database storage, and so on.
• You can create Magnetic volumes that range in size from a minimum of
1 GB all the way up to 1 TB.
• Size (GiB): Provide the size of your volume in GB. Here, I provided 10 GB.
• IOPS: This field will only be editable if you have selected Provisioned IOPS (SSD) as
the volume's type. Enter the max IOPS value as per your requirements.
• Availability Zone: Select the appropriate availability zone in which you wish to
create the volume. Remember, an EBS volume can span availability zones, but not
regions.
• RAM disk ID, Kernel ID: You can select and provide your AMI with its own RAM disk ID (ARI)
and Kernel ID (AKI); however, in this case I have opted to keep the default ones.
• Block Device Mappings: You can use this dialog to either expand your root volume's size or
add additional volumes to it. You can change the Volume Type from General Purpose (SSD)
to Provisioned IOPS (SSD) or Magnetic as per your AMI's requirements. For now, I have left
these to their default values.
• An important point to note here is that you will not be able to delete this particular EBS
Snapshot now as it is in use by your AMI. You will have to deregister your AMI first from the
AMI Management dashboard and then try and delete the snapshot.
• Buckets
• Objects
• Keys
• Regions
• For example, if the object named photos/puppy.jpg is stored in the johnsmith bucket, then it is
addressable using the URL http://johnsmith.s3.amazonaws.com/photos/puppy.jpg
• You can configure buckets so that they are created in different regions.
• You can also configure a bucket so that every time an object is added to it, Amazon S3 generates a
unique version ID and assigns it to the object.
• The metadata is a set of name-value pairs that describe the object. These include some default
metadata, such as the date last modified, and standard HTTP metadata, such as Content-Type. You
can also specify custom metadata at the time the object is stored.
• Every object in a bucket has exactly one key. Because the combination of a bucket, key, and version
ID uniquely identify each object.
• Amazon S3 can be thought of as a basic data map between "bucket + key + version" and the object
itself. Every object in Amazon S3 can be uniquely addressed through the combination of the web
service endpoint, bucket name, key, and optionally, a version.
*An object is the fundamental entity in S3. It consists of data, key and metadata.
Therefore, Amazon came up with 3 storage classes to provide its customers the best experience and at
an affordable cost.
.Amazon Glacier
Suitable for use cases where the data is to be archived, and high performance is not required, it has a
lower cost than the other two services. e.g. in the hospital, patients’ test reports, prescriptions, MRI, X
Ray, Scan docs etc. that are older than a year will not be needed in the daily run and even if it is
required, lower latency is not needed.
• Amazon S3 offers a range of storage classes designed for different use cases.
• These include Amazon S3 STANDARD for general-purpose storage of frequently accessed data.
• Bucket policies provide centralized access control to buckets and objects based on a variety of
conditions,
• Including Amazon S3 operations, requesters, resources, and aspects of the request (e.g., IP address).
The policies are expressed in our access policy language and enable centralized management of
permissions.
• The permissions attached to a bucket apply to all of the objects in that bucket.
• You must explicitly enable versioning on your bucket. By default, versioning is disabled. Regardless of
whether you have enabled versioning, each object in your bucket has a version ID.
• If you have not enabled versioning, Amazon S3 sets the value of the version ID to null. If you have
enabled versioning, Amazon S3 assigns a unique version ID value for the object. When you enable
versioning on a bucket, objects already stored in the bucket are unchanged. The version IDs (null),
contents, and permissions remain the same.
Common Operations
• Create a Bucket – Create and name your own bucket in which to store your objects.
• Write an Object – Store data by creating or overwriting an object. When you write an object, you
specify a unique key in the namespace of your bucket. This is also a good time to specify any access
control you want on the object.
• Read an Object – Read data back. You can download the data via HTTP or BitTorrent.
• Deleting an Object – Delete some of your data.
• Listing Keys – List the keys contained in one of your buckets. You can filter the key list based on a
prefix.
By
Reyaz Shaik
• Classic Load Balancer provides basic load balancing across multiple Amazon EC2 instances
and operates at both the request level and connection level.
• Classic Load Balancer is intended for applications that were built within the EC2-Classic
network. We recommend Application Load Balancer for Layer 7 and Network Load Balancer for
Layer 4 when using Virtual Private Cloud (VPC).
Paste the IP address of this instance with /blog as the suffix in the
browser and hit Enter. You should see something like below.
2. Give a name to your load balancer and select at least two availability zones for high
availability and click on the Next: Configure Security Settings button.
For /blog
• It is a fundamental service that protects your applications and data from a variety of
cyber-attacks, security breaches, accidental or deliberate data deletions, theft, and
much more.
• To read the complete list, visit the AWSrisk and compliance whitepaper at
http://aws.amazon.com/security/.
AWS provides a few services and products that are specifically designed to help
you secure your infrastructure on the cloud, such as IAM, AWS Multi-Factor
Authentication (AWS MFA), AWS Cloud Trail, and much more.
Rise 'n' Shine Technologies 5
Amazon IAM(Identity & Access Management)
• You can use IAM to create users and groups, assigning users specific permissions
and policies, and a lot more.
• The best part of all this is that IAM is completely FREE. Yup! Not a penny is
required to use it.
• Multi-factor authentication:
• along with your password, you will also have to provide a secret key/pin from a
special hardware device, or even from software apps such as Google
Authenticator.
RNS
Admin
DevTL TestTL
Dev1 Test1
Dev2 Test2
Rise 'n' Shine Technologies 10
Getting started with the IAM Console
• To begin with, sign in to the AWS Management Console
using https://console.aws.amazon.com/
• Note: Access keys are unique to each user and should not be shared
with anyone under any circumstances. Save them in a secure place.
• They are also responsible for controlling actions that you can perform
on the resources.
TestTL
Read on EC2
Rise 'n' Shine Technologies 20
Policy – JSON Format
• Let's look at a simple policy for our reference:
• {
• "Version": "2012-10-17",
• "Statement": [
• {
• "Effect": "Allow",
• "Action": [
• "ec2:DescribeInstances",
• "ec2:DescribeImages"
• ],
• "Resource": "arn:aws:iam::012345678910:user/admin"
• }
• ] Rise 'n' Shine Technologies 21
Creating and assigning policies
• IAM Policies
• filter and list existing policies (both inline and manage
policies) using the Filter and Search options
• Create Policy
• Copy an AWS Managed Policy:
• Policy Generator:
• Create your Own Policy:
• These logs can contain information such as the API's request and
response parameters, who made the API call, the time of the API call,
and so on.
• These details are vital and can be used during security audits,
compliance tracking, and so on.
• Create a separate IAM users for your organization, each with their own sets of
access and Secret Keys. DO NOT SHARE YOUR KEYS OR PASSWORDS!
Sharing such things is never a good idea and can cause serious implications
and problems.
• Create separate administrators for each of the AWS services that you use.
• Use roles and groups to assign individual IAM users permissions. Provide only
the required level of access and permissions that the task demands.
Rise 'n' Shine Technologies 28
IAM - Best Practices
• Leverage multi-factor authentication (MFA) wherever possible.
• Rotate your passwords and keys on a periodic basis. Create keys only if there
is a requirement for it.
• Maintain a logs and history of your AWS account and its services. Use
AWSCloudTrail for security and compliance auditing.
• Use temporary credentials (IAM Roles) rather than sharing your account
details with other users and applications.
• Leverage AWS Key Management Service to encrypt data and your keys
wherever necessary. Rise 'n' Shine Technologies 29
What you have on the IAM Dashboard
• Users
• Groups
• Roles
• Policies
• Identity Providers
• Accounts Settings
• Credentials Report
• Encryption keys
arn:aws:iam::account-ID-without-hyphens:user/Richard
You cannot request a limit increase for the following limits like access keys 2. You can refer AWS documentaion
Click Next
Create Group
Next: Tags
Create Role
Create Policy
Create topic if you don’t have any notification enabled. Next slide has the screen shot of create topic
• Create Alarm
By
Reyaz Shaik
Configuration templates
• Your group uses a launch template or a launch configuration as a configuration template for its EC2
instances. You can specify information such as the AMI ID, instance type, key pair, security groups,
and block device mapping for your instances.
Scaling options
• Amazon EC2 Auto Scaling provides several ways for you to scale your Auto Scaling groups. For
example, you can configure a group to scale based on the occurrence of specified conditions
(dynamic scaling) or on a schedule.
Create
• Launch 2 EC2 instances and setup a small web app on both instances.
• Launch and ELB and attach the EC2 instances with it.
• Usually its very difficult to remember all the IP address of the EC2 instances
• Instead let us create a route53 record to access it through the hostname
IT WORKED!!!!
• Amazon Relational Database Service (Amazon RDS) is a web service that makes it
easier to set up, operate, and scale a relational database in the cloud. It provides
cost-efficient, resizable capacity for an industry-standard relational database and
manages common database administration tasks.
• So people often develop a misconception, when they confuse RDS with a database.
• RDS is not a database, it’s a service that manages databases, having said that, let’s
discuss the databases that RDS can manage as of now
You can use this default VPC just as any other VPC by creating additional subnets in it,
provisioning route tables, security groups, and so on.
Note: Any other VPC that you create besides the default VPC is called as the non-default VPC.
Each non-default VPC in turn contains non-default subnets, and so on and so forth.
Tooooo Much ?
CLOUD TRAIL
Create
Once you got the keys, those keys would be your username and password for SMTP
Below are the configuration of SMTP on your application. Username= access key, password = secret key