WordPress
with
CloudFront + AMAZON RDS + S3
@Amimoto_Ami
amimoto-ami.com
Slide 2
Slide 2 text
Architecture
Slide 3
Slide 3 text
AMAZON CloudFront
AMAZON RDS
AMAZON S3
w %#XJUIIJHIGBJMVSFUPMFSBODF
w TQFFEVQDPOUFOUTEFMJWFSZXJUI$%/
w $PTUF⒎FDUJWFNFEJBTUPSBHFT
(PBM
Slide 4
Slide 4 text
Starting up AWS services
Plugins configurations
Workflow
Preparations
Slide 5
Slide 5 text
Preparations
for
construction
Slide 6
Slide 6 text
http://bit.ly/1Xio3cC
-JTUPGDPNNBOET
Slide 7
Slide 7 text
AWS CLI installation
CloudFront corresponding
Workflow
Start up AMIMOTO AMI
preparations
Slide 8
Slide 8 text
AWS CLI installation
CloudFront corresponding
Workflow
Start up AMIMOTO AMI
preparations
Slide 9
Slide 9 text
https://aws.amazon.com/marketplace/pp/B01DAONMCK/
Slide 10
Slide 10 text
When you start up AMIMOTO,
step forward until this “Welcome” page.
Slide 11
Slide 11 text
AWS CLI installation
CloudFront corresponding
Workflow
Start up AMIMOTO AMI
preparations
Slide 12
Slide 12 text
AWS CLI
w $PNNBOE-JOF*OUFSGBDFGPS"84
w :PVDBONBOJQVMBUFBMMUISPVHI
DPNNBOEMJOF
w 'PSDPOpHVSFUIF$MPVE'SPOU
"84$-*
Slide 13
Slide 13 text
Create IAM user
Initial setup
Workflow
AWS-CLI installation
Slide 14
Slide 14 text
Create IAM user
Initial setup
Workflow
AWS-CLI installation
Slide 15
Slide 15 text
1. Install AWS Command Line Interface (aws-cli) to your Mac or PC
Two ways to install aws-cli:
- Install follow the AWS user guide page:
http://docs.aws.amazon.com/cli/latest/userguide/installing.html
- Install through package manager Homebrew, if you use Mac:
http://brew.sh/index.html
"84$-*JOTUBMMBUJPO
Slide 16
Slide 16 text
Copy below command and pate into your terminal.app then hit [return] key
$ /usr/bin/ruby -e "$(curl -fsSL https://
raw.githubusercontent.com/Homebrew/install/
master/install)"
$ brew install wget
$ brew install awscli
'PS.BDVTFST
Slide 17
Slide 17 text
'PS8JOEPXTVTFS
w %PXOMPBEUIF"84$-*.4*JOTUBMMFSGPS8JOEPXT CJU
IUUQTTBNB[POBXTDPNBXTDMJ"84$-*NTJ
w %PXOMPBEUIF"84$-*.4*JOTUBMMFSGPS8JOEPXT CJU
IUUQTTBNB[POBXTDPNBXTDMJ"84$-*NTJ
Slide 18
Slide 18 text
Create IAM user
Initial setup
Workflow
AWS-CLI installation
Slide 19
Slide 19 text
No content
Slide 20
Slide 20 text
move to Identity and Access Management
Slide 21
Slide 21 text
Create new user
Slide 22
Slide 22 text
Enter a user name and generate access key.
BNJNPUPDMJ
BNJNPUPDMJ
Slide 23
Slide 23 text
Save security credentials to your local (anywhere you want)
Slide 24
Slide 24 text
Attach policy to created user
Slide 25
Slide 25 text
Choose CloudFrontFullAccess and…
Slide 26
Slide 26 text
Choose AmazonS3FullAccess then click [Attach Policy]
Slide 27
Slide 27 text
Two policies are attached to the user
Slide 28
Slide 28 text
Create IAM user
Initial setup
Workflow
AWS-CLI installation
Slide 29
Slide 29 text
aws configure --profile amimoto-cli
Slide 30
Slide 30 text
4BNQMFDPOpHVSBUJPO
AWS Access Key ID [None]: XXXXXXXXXXXXXXXXXXXX
AWS Secret Access Key [None]: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Default region name [None]: ap-northeast-1
Default output format [None]: JSON
Slide 31
Slide 31 text
AWS Access Key ID and AWS Secret Access Key
Slide 32
Slide 32 text
4BNQMFDPOpHVSBUJPO
AWS Access Key ID [None]: XXXXXXXXXXXXXXXXXXXX
AWS Secret Access Key [None]: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Default region name [None]: ap-northeast-1
Default output format [None]: JSON
Slide 33
Slide 33 text
AWS CLI installation
CloudFront corresponding
Workflow
Start up AMIMOTO AMI
preparations
Slide 34
Slide 34 text
aws --profile amimoto-cli configure set preview.cloudfront true
$POpHVSBUJPODPNNBOE
Slide 35
Slide 35 text
aws --profile amimoto-cli cloudfront help
$POpHVSBUJPODIFDL
Slide 36
Slide 36 text
No content
Slide 37
Slide 37 text
Setting up
AWS services
Slide 38
Slide 38 text
Amazon RDS
Amazon S3
Workflow
CloudFront
Slide 39
Slide 39 text
Amazon RDS
Amazon S3
Workflow
CloudFront
Slide 40
Slide 40 text
AMAZON CloudFront
•Global content delivery network
(CDN) service
•High data transfer speeds and
reduce server load
•Supports failover if a failure
• Install WordPress into the server’s document root directory;
• Replace {ORIGIN URL} to the server domain name (or Public DNS) of AMIMOTO;
• Change amimoto-cli to your created profile, if necessary;
• On this hands-on, set
Public DNS of EC2 to {ORIGIN URL}
/PUF
Slide 44
Slide 44 text
*GZPVDBOOPUpOE1VCMJD%/4PO&$
Check following documents:
Updating DNS Support for Your VPC
http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-
dns.html#vpc-dns-updating
or
AWSͰPublic DNS(ύϒϦοΫDNS)ׂ͕ΓͯΒΕͳ͍࣌ͷղܾ๏
http://qiita.com/kasokai/items/4ea689ce9f206e78a523
20-30 minutes to complete for
CloudFront starts up
Slide 48
Slide 48 text
Amazon S3
Amazon RDS
Workflow
CloudFront
Slide 49
Slide 49 text
AMAZON S3
•AWS storage service
•Data is stored on redundant servers
in multiple data centres
•High fault tolerance
•No limit on the number of items
can be stored •
Slide 50
Slide 50 text
Click S3 on AWS Console page.
Slide 51
Slide 51 text
Create a bucket
Slide 52
Slide 52 text
Name a bucket; unique and easy to specify
Slide 53
Slide 53 text
Bucket properties
Slide 54
Slide 54 text
Copy Endpoint and paste it to the text file.
Slide 55
Slide 55 text
Choose Enable website hosting
Slide 56
Slide 56 text
Input index.html into Index Document
Slide 57
Slide 57 text
Click [Save] to apply settings.
Slide 58
Slide 58 text
Amazon S3
Amazon RDS
Workflow
CloudFront
Slide 59
Slide 59 text
AMAZON RDS
•Managed DB service
•Single click to change specification
•Easy to replication
Slide 60
Slide 60 text
AMAZON RDS
MariaDB
Amazon Aurora
Various DB engine
MySQL
Slide 61
Slide 61 text
Switching DB to RDS
Workflow
Set up
Slide 62
Slide 62 text
Switching DB to RDS
Workflow
Set up
Slide 63
Slide 63 text
No content
Slide 64
Slide 64 text
No content
Slide 65
Slide 65 text
No content
Slide 66
Slide 66 text
No content
Slide 67
Slide 67 text
Values to input
• DB Instance IdentifierɿName of DB instance
• Master UsernameɿRoot user of DB
• Master PasswordɿPassword for root user of DB
• Confirm PasswordɿConfirmation password for root user of DB
Copy and paste them to notepad and save as text file.
Slide 68
Slide 68 text
No content
Slide 69
Slide 69 text
)PTUOBNFPG
EBUBCBTF
Slide 70
Slide 70 text
No content
Slide 71
Slide 71 text
No content
Slide 72
Slide 72 text
Coffee break
Slide 73
Slide 73 text
No content
Slide 74
Slide 74 text
%BUBCBTF63-
Slide 75
Slide 75 text
No content
Slide 76
Slide 76 text
No content
Slide 77
Slide 77 text
No content
Slide 78
Slide 78 text
Switching DB to RDS
Workflow
Set up
Slide 79
Slide 79 text
&EJUMPDBMDPOpHQIQ
$ sudo su -
# cd /var/www/vhosts/{INSTANCE_ID}
# vim local-config.php
Activate Nephila clavata plugin on WordPress Dashboard
Slide 93
Slide 93 text
Configure the plugin
Slide 94
Slide 94 text
Values to input
• AWS Access Key: Access key for IAM user amimoto-s3
• AWS Secret Key: Access key for IAM user amimoto-s3
• AWS Region: Region (optional)
• S3 Bucket: S3 bucket name
• S3 URL: S3 bucket URL
• Storage Class: Choose STANDARD
$$MPVE'SPOU$MFBS$BDIF
• CloudFrontΩϟογϡআ࣌ʹ՝
ۚ͞ΕΔͷͰཁҙ
• Flush CloudFront Cache on
WordPress
• Flush automatically when article
published/updated or manually
• Pay as each request for invalidation