Upload
jhalak-modi
View
129
Download
0
Embed Size (px)
Citation preview
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Dynamic Website with Load Balancing
AWS Meetup Team
Ahmedabad Amazon AWS Cloud MeetupAhmedabad
28 March 2015
1 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Overview
1 Speaker’s Note
2 Architecture Diagram
3 EC2
4 Deploy Your App
5 Commands
6 ELB
7 Route 53
8 Clean up
2 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Speaker’s Note
Sham Arsiwala
• Red Hat Certified Architect
• 14+ years of exp. with Linux, Virtulization and Cloud
• mailid: [email protected]
• Ph. No: 9099099855
Jhalak Modi
• Cloudian
• mailid: [email protected]
• Ph. No: 9099099853
3 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Architecture Diagram
4 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Elastic Compute Cloud
Elastic Compute Cloud
5 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Elastic Compute Cloud (EC2) is...
• Hardware As A Service
• A Web service that provides resizable compute capacity inthe cloud.
• Designed to make Web-scale computing easier fordevelopers.
• A simple Web service interface that provides completecontrol of your computing resources
• create/destroy from the command line
6 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Concepts
• Amazon Machine Image (AMI):• Bootable root disk• Pre-defined or user-built• Catalog of user-built AMIs• OS: Fedora, Centos, Gentoo, Debian, Ubuntu, Windows
Server
• Instance:• Running copy of an AMI• Launch in less than 2 minutes• Start or stop programmatically
• Network Security Model:• Explicit access control• Security groups
• Inter-service bandwidth is free
7 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Using EC2
• Create an Amazon Machine Image (AMI).
• Configure security and network access.
• Choose the type(s) of instance you want to run.
• Start, terminate, and monitor as many instances of yourAMI as needed, using the web service APIs.
• Pay for the instance-hours and bandwidth that youactually consume.
8 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Tasks to be Performed
• create and configure your security group
• Launch Your EC2 Instance
• Select EBS
• Choose Key Pair
• Configure Apache, php and MySQL
• Create AMI
9 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Concusion
• Reduces the time required to obtain and boot new serverinstances to minutes
• Quickly scales capacity, both up and down, as yourcomputing requirements change
• Changes the economics of computing
• Pay only for capacity that you actually use
10 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Deploy Your App
• Connect to Your Linux Instance• ssh -i my-key-pair.pem
• Configure the EC2 Instance• Start the Web Server• Install the App• Test the Website• Update Permissions
• Create a Custom AMI
11 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Commands
# chmod 600 yourkey.pem# ssh -i yourkey.pem [email protected]# sudo -i# yum update# yum install httpd mariadb-server mariadb php php-mysqlphp-gd php-pear php-mbstring php-pgsql vim# systemctl status httpd.service# systemctl start httpd.service# systemctl enable httpd.service# systemctl start mariadb.service# systemctl enable mariadb.service# mysql secure installation
12 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Commands (Continued..)
# mysql -u root -predhat@123mysql>CREATE USER ’admin’@’localhost’ IDENTIFIED
BY ’redhat@123’;mysql>CREATE DATABASE ‘wordpress-db‘;mysql>GRANT ALL PRIVILEGES ON ‘wordpress-db‘.*
TO ”admin”@”localhost”;mysql>FLUSH PRIVILEGES;mysql>exit
# cd /var/www/html/# vim info.php
<?php phpinfo(); ?>
13 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Commands (Continued..)
# yum install wget unzip net-tools# wget http://wordpress.org/latest.zip# unzip -q latest.zip -d /var/www/html/# sudo rsync -avP /var/www/html/wordpress//var/www/html/# cp wp-config-sample.php wp-config.php#vim wp-config.php
define(’DB NAME’, ’wordpress-db’);define(’DB USER’, ’admin’);define(’DB PASSWORD’, ’your strong password’);define(‘DB HOST’, ‘localhost’);
14 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Commands (Continued..)
Enter public IP of EC2 Instance in the web browser (either thepublic DNS address for your instance, or that address followedby the blog folder)Enter the remaining installation information into theWordPress installation wizard.
• Site Title: Enter a name for your WordPress site.• Username: Enter a name for your WordPress
administrator. For security purposes you should choose aunique name for this user, since this will be more difficultto exploit than the default user name, admin.
• Password: Enter a strong password, and then enter itagain to confirm. Do not reuse an existing password, andmake sure to store this password in a safe place.
• Your E-mail: Enter the email address you want to use fornotifications.
• Click Install WordPress to complete the installation. 15 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Elastic Load Balancing
Elastic Load Balancing(ELB)
16 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Overview
Elastic Load Balancing automatically distributes incomingapplication traffic across multiple Amazon EC2 instances in thecloud. It enables you to achieve greater levels of fault tolerancein your applications, seamlessly providing the required amountof load balancing capacity needed to distribute applicationtraffic.
17 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Benefits and Use Cases
Benefits
• Available: Achieve higher levels of fault tolerance for yourapplications
• Elastic: automatically scales its request handling capacityto meet the demands of application traffic
• Secure: provide robust networking and security features
18 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Benefits and Use Cases
Use Cases
• Achieving Even Better Fault Tolerance for YourApplications
• DNS Failover for Elastic Load Balancing
• Auto Scaling with Elastic Load Balancing
• Easy to create an internet-facing entry point into yourVPC or to balance load between tiers of your applicationwithin your VPC
19 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Tasks to be Performed
• Configure Load Balancing
• Assign Security Groups
• Test Your Load Balancer
20 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Tasks to be Performed
• Register a Domain Name
• Allocate Name Servers to Route Traffic for Your Domain
• Create Record Sets for Your Domain and Subdomain
• Set Up a DNS Provider
21 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Clean up
• Delete the Amazon Route 53 Hosted Zone
• Delete the Amazon Route 53 Hosted Zone
• Delete the Auto Scaling Group
• Delete the Load Balance
• Delete Your Custom AMI
• Terminate the DB Instance
22 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Queries...?
23 / 24
DynamicWebsite with
LoadBalancing
AWS MeetupTeam
Speaker’sNote
ArchitectureDiagram
EC2
Deploy YourApp
Commands
ELB
Route 53
Clean up
Thank You...
24 / 24