wordpress & cloud: integration with aws

47
1 di 47 Cascina Roccafranca – Torino – 16 giugno 2012 Gabriele Mittica – gabrielemittica.com – [email protected] - @gabrielemittica WORDPRESS & AMAZON WEB SERVICES

Upload: corley-srl

Post on 27-Jan-2015

117 views

Category:

Technology


3 download

DESCRIPTION

How-to, tutorial and tips.

TRANSCRIPT

Page 1: WordPress & Cloud: integration with AWS

1 di 47

Cascina Roccafranca – Torino – 16 giugno 2012Gabriele Mittica – gabrielemittica.com – [email protected] - @gabrielemittica

WORDPRESS & AMAZON WEB SERVICES

Page 2: WordPress & Cloud: integration with AWS

2 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

CHAPTER 1.

INTRODUCING THE CLOUD

Page 3: WordPress & Cloud: integration with AWS

3 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

What is CLOUD COMPUTING?

Cloud computing refers to the delivery of computing and storage capacity as a service to a heterogeneous community of end-recipients.

Cloud computing entrusts services with a user's data, software and computation over a network.

It has considerable overlap with software as a service (SaaS).

Page 4: WordPress & Cloud: integration with AWS

4 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

FAQ about the cloud…Is the cloud just a fad?No.It’s a rational evolution of IT architecture towards a more efficient way of managing resources and designing Web applications efficiently.

Is the cloud cheap?No.The cloud allows you to pay the right for each service involved.

Is the cloud just a scalable vps?No.The cloud is a set of services designed to meet specific computing needs.

1.

2.

3.

Page 5: WordPress & Cloud: integration with AWS

5 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

Advantages

- access to unlimited resources

- scalable architecture

- no hardware dependency

- pay as you go

- geographical redundancy

- high availability

- increased competition for start-up

Page 6: WordPress & Cloud: integration with AWS

6 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

AWS - Amazon Web Services

Services

Scalable virtual machines

Storage services

Content delivery network

Autoscaling & loadbalancing

Realational & No-SQL DB

Private Cloud & Policies

… much more

Pricing

On-demand & reserved servers

Storage starting from 0.093$ / GB

Bill by credit card

Consolidated billing

Free tier

No setup fee

Dev & Social

SDK & xml webservices

Community forum

Premium support

Events & webinar

Start-up challenge

Page 7: WordPress & Cloud: integration with AWS
Page 8: WordPress & Cloud: integration with AWS
Page 9: WordPress & Cloud: integration with AWS
Page 10: WordPress & Cloud: integration with AWS

10 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

AWS - Links- Home page: http://aws.amazon.com/- About AWS: https://aws.amazon.com/what-is-aws/- All products: http://aws.amazon.com/products/- Dev area: http://aws.amazon.com/resources/- Documentation: http://aws.amazon.com/documentation/- SDK: http://aws.amazon.com/code/- Community: https://forums.aws.amazon.com/index.jspa- AWS Blog: http://aws.typepad.com/- Events: https://aws.amazon.com/about-aws/events/- Services Health Dashboard: http://status.aws.amazon.com/- Pricing Calculator: http://calculator.s3.amazonaws.com/calc5.html

Page 11: WordPress & Cloud: integration with AWS

11 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

CHAPTER 2.

WP + S3 + CLOUDFRONT

Page 12: WordPress & Cloud: integration with AWS

12 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + S3 + CloudFront

Uploads your wordpress attachements to S3 with an option CloudFront distribution.

This WordPress plugin allows you to use Amazon's Simple Storage Service to host your media for your WordPress powered blog with an optional CloudFront distribution.

Plugin homepage: http://wordpress.org/extend/plugins/tantan-s3-cloudfront/

Services involved:Simple Storage Service (S3):S3 provides a simple web services interface that can be used to store and retrieve any amount of data, at any time, from anywhere on the web. It provides 99.999999999% durability.

CloudFront:CF can be used to deliver your entire website, including dynamic, static and streaming content using a global network of edge locations.Over 30 edge locations.

Page 13: WordPress & Cloud: integration with AWS

13 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + S3 + CloudFront

Tipical use of WordPress: html and media files are provided by apache (http request):

Page 14: WordPress & Cloud: integration with AWS

14 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + S3 + CloudFront

Thanks to S3 and CloudFront, you can easily send all your media files through the content Delivery Network

Page 15: WordPress & Cloud: integration with AWS

15 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + S3 + CloudFront: configCreate a new user in aws console:

Page 16: WordPress & Cloud: integration with AWS

16 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + S3 + CloudFront: configDownload Credentials:

Page 17: WordPress & Cloud: integration with AWS

17 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + S3 + CloudFront: configThen set the policy:

Page 18: WordPress & Cloud: integration with AWS

18 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + S3 + CloudFront: configGrant full access to S3 management:

Page 19: WordPress & Cloud: integration with AWS

19 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + S3 + CloudFront: configCreate a new bucket in S3 console:

Page 20: WordPress & Cloud: integration with AWS

20 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + S3 + CloudFront: configThen go in CloudFront console and create a new CF distribution:

Page 21: WordPress & Cloud: integration with AWS

21 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + S3 + CloudFront: configSelect the bucket created as origin:

Page 22: WordPress & Cloud: integration with AWS

22 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + S3 + CloudFront: configEnable the new cloudfront distribution:

Page 23: WordPress & Cloud: integration with AWS

23 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + S3 + CloudFront: configDownload the wordpress Plugin (http://wordpress.org/extend/plugins/tantan-s3-cloudfront/) and follow these steps:

- Upload tantan-s3-cloudfront to the /wp-content/plugins/ directory- Activate the plugin through the 'Plugins' menu in WordPress- Configure the plugin in the 'Options' (or 'Settings') screen by following the

onscreen prompts.- Set an optional CloudFront distribution URL (must be paired with your S3

bucket on AWS)

Page 24: WordPress & Cloud: integration with AWS

24 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + S3 + CloudFront: configSet the plugin options:

Page 25: WordPress & Cloud: integration with AWS

25 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + S3 + CloudFront: usageNow each file uploaded is hosted by S3 and provided by CloudFront:

Page 26: WordPress & Cloud: integration with AWS

26 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + S3 + CloudFront: advantages

- Easy to use

- Cost affordable

- Very-low latency

- Reduced load on the server

- Increased page speed

- Useful in big files hosting, download repository, media files

- Useful in js/css/images distribution

Page 27: WordPress & Cloud: integration with AWS

27 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

CHAPTER 3.

WP + CLOUDFRONT

Page 28: WordPress & Cloud: integration with AWS

28 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + CloudFront

CloudFront helps you to provide your content through a world wild content delivery network.

Following this how-to you can easily set CloudFront to provide all your data (html, css, js, images, videos and more).

You need:- An active AWS account- Dns management - Edit your wp-config.php file- No plugins required

Services involved:

CloudFront:CF can be used to deliver your entire website, including dynamic, static and streaming content using a global network of edge locations.Over 30 edge locations.

You need to edit the dns configuration of your website in order to use properly this tutorial.

Page 29: WordPress & Cloud: integration with AWS

29 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + CloudFront

Tipical use of WordPress:

Page 30: WordPress & Cloud: integration with AWS

30 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + CloudFront

Wordpress hosted by CloudFront:

Page 31: WordPress & Cloud: integration with AWS

31 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + CloudFront: config

Edit the dns configuration of your website:

www.example.com. CNAME your-cloudfront-distribution-url cdn.example.com. A your-server-ip

Page 32: WordPress & Cloud: integration with AWS

32 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + CloudFront: configThen go in CloudFront console and create a new CF distribution:

Page 33: WordPress & Cloud: integration with AWS

33 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + CloudFront: configSet your subdomain as origin:

Page 34: WordPress & Cloud: integration with AWS

34 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + CloudFront: configEnable the new CloudFront distribution:

Page 35: WordPress & Cloud: integration with AWS

35 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + CloudFront: config

Place in your wp-config.php file:

define('WP_ALLOW_MULTISITE', true);define('COOKIEPATH', '/');define('COOKIE_DOMAIN', '. example.com'); if(strpos($_SERVER['SCRIPT_NAME'], "/wp-login")===0 || strpos($_SERVER['SCRIPT_NAME'], "/wp-admin")===0) {

define('WP_HOME','http://cdn.example.com');define('WP_SITEURL','http://cdn.example.com');

}

Page 36: WordPress & Cloud: integration with AWS

36 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP + CloudFront: pros & cons

PROS:

- Fast implementation

- No-load on your server

- High-speed, low-latency

- Useful for product website or

website with heavy traffic

CONS:

- No POST data managed

- Comment system unavailable

(use DISQUS instead)

- Pay attention to cache timeout

Page 37: WordPress & Cloud: integration with AWS

37 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

CHAPTER 4.

SENDING EMAILS WITH SES

Page 38: WordPress & Cloud: integration with AWS

38 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

Sending emails with SES

WP-SES is a plugin that redirects all outgoing WordPress emails through Amazon Simple Email Service (SES) for maximum email delivrability.

You can download this plugin on official website http://wp-ses.com/

Requires: 3.0.0 or higherCompatible up to: 3.0.5

Services involved:

Simple Email Service (SES):SES is a highly scalable and cost-effective bulk and transactional email-sending service for businesses and developersOnly $0.10 per thousand.

Page 39: WordPress & Cloud: integration with AWS

39 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

Sending emails with SES: features

- Ability to adjust WordPress Default Sender Email and Name

- Validation of Amazon API Credentials

- Request confirmation for sender Emails

- Test message within Amazon Sandbox mode

- Full Test message within Amazon Production mode

- Full integration as seamless replacement for wp_mail internal function

- Dasboard panel with Quota and statistics

- Ability to customize return path for delivery failure notifications

Page 40: WordPress & Cloud: integration with AWS

40 di 47

Page 41: WordPress & Cloud: integration with AWS

41 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

Sending emails with SES: config

First, install like any other plugin:- Upload and activate the plugin- The setting are in settings / WP SESThen, proceed to the settings:- Fill the email address and name to use as the sender for all emails- Fill in Amazon API credentials- Save changes (Important !)- Ask to add the email as a confirmed sender- Click on the link you got by email from Amazon SES- Refresh the plugin, send a test email- If ok, ask Amazon to go out of sandbox into production mode- Once in production mode, you can use the top button to activate the plugin.

Page 42: WordPress & Cloud: integration with AWS

42 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

Sending emails with SES: configPlugin configuration:

Page 43: WordPress & Cloud: integration with AWS

43 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

CHAPTER 5.

WP HOSTING WITH AWS

Page 44: WordPress & Cloud: integration with AWS

44 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP hosting with AWS

Autoscaling+High Availability

Thanks to AWS you can setup Wordpress to scaling up and down and grant high-availability to your customers.

Some advantages:- Ability to Serve millions of pages/day- Ability to scale out/down dynamically- Should be Highly available- Automated Backup and Monitoring- Cost effective

-

This process involves a lot of services: EC2, Autoscaling, RDS, S3, ROUTE 53, CloudFront…

http://aws.amazon.com/products/

Page 45: WordPress & Cloud: integration with AWS
Page 46: WordPress & Cloud: integration with AWS

46 di 47Corley S.r.l.Piazza Statuto 10, Torino (10122)P.Iva 10669790015www.corley.it

WP hosting with AWS: links- How-to part one: http://

harish11g.blogspot.it/2012/01/scaling-wordpress-aws-amazon-ec2-high.html- How-to part two: http://

harish11g.blogspot.it/2012/02/wordpress-aws-ec2-architecture-part2.html- FAQ about WP on AWS: http://

harish11g.blogspot.in/2012/02/faq-scaling-wordpress-aws-ec2-million.html- Slides on SlideShare:

http://www.slideshare.net/harishganesan/scaling-wordpress-in-aws-amazon-ec2- AWS Architecture Center: http://aws.amazon.com/architecture/- AWS Web hosting architecture: http://

d36cz9buwru1tt.cloudfront.net/architecturecenter/AWS_ac_ra_web_01.pdf- WP on EC2 + RDS tutorial:

http://wp.tutsplus.com/tutorials/scaling-caching/deploy-your-wordpress-blog-to-the-cloud/

Page 47: WordPress & Cloud: integration with AWS

47 di 47

Cascina Roccafranca – Torino – 16 giugno 2012Gabriele Mittica – gabrielemittica.com – [email protected] - @gabrielemittica

Thank you for listening