Upgrade to Pro — share decks privately, control downloads, hide ads and more …

[日本語] WordPress with CloudFront + AMAZON RDS + S3

[日本語] WordPress with CloudFront + AMAZON RDS + S3

More Decks by Amimoto - Flexible Cloud WordPress Hosting

Other Decks in How-to & DIY

Transcript

  1. 1. Mac ΍ PC ΁ AWS ίϚϯυϥΠϯΠϯλʔϑΣΠε (aws-cli) ΛΠϯετʔϧ
 


    aws-cli ͷΠϯετʔϧํ๏͸ೋ௨Γ:
 - AWS ϢʔβΨΠυϖʔδͷखॱͰߦ͏:
 http://docs.aws.amazon.com/cli/latest/userguide/installing.html
 
 - Mac ͷ৔߹͸ ύοέʔδϚωʔδϟͷ Homebrew Λ࢖ͬͯΠϯετʔϧΛ͢Δ:
 http://brew.sh/index.html
 "84$-*ͷΠϯετʔϧ
  2. ઃఆΠϝʔδ AWS Access Key ID [None]: XXXXXXXXXXXXXXXXXXXX
 AWS Secret Access

    Key [None]: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 Default region name [None]: ap-northeast-1
 Default output format [None]: JSON
  3. ઃఆΠϝʔδ AWS Access Key ID [None]: XXXXXXXXXXXXXXXXXXXX
 AWS Secret Access

    Key [None]: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 Default region name [None]: ap-northeast-1
 Default output format [None]: JSON
  4. export origin_url='{ORIGIN URL}'; aws --profile amimoto-cli cloudfront create-distribution --cli- input-json

    "$(curl -l -s https:// raw.githubusercontent.com/amimoto-ami/create-cf- dist-settings/master/source_dist_setting.sh | sh)" "84$-*͔ΒηοτΞοϓ
  5. ೖྗ͢Δ஋ • DB Instance IdentifierɿDBΠϯελϯε໊ • Master UsernameɿDBͷϧʔτϢʔβʔ໊ • Master

    PasswordɿDBͷϧʔτϢʔβʔύεϫʔυ • Confirm Passwordɿύεϫʔυͷ֬ೝ ͋ͱͰ࢖͏ͷͰɺςΩετΤσΟλͳͲʹϝϞ
  6. มߋ͢Δ৔ॴʢ11ʙ18ߦ໨෇ۙʣ if ( !$db_data ) { $db_data = array( 'database'

    => '{Database Name}', 'username' => '{Master Username}', 'password' => '{Master Password}', 'host' => '{RDS_ENDPOINT}', ); }
  7. MySQLͷࣗಈىಈΛఀࢭ • Before { "mod_php7" : { "enabled": true },

    "run_list" : [ "recipe[amimoto]" ] } • After { "mod_php7" : { "enabled": true }, "mysql": { "enabled": false }, "run_list" : [ "recipe[amimoto]" ] }
  8. ೖྗ͢Δ஋ • AWS Access Keyɿamimoto-s3ͷaccesskey • AWS Secret Keyɿamimoto-s3ͷsecret key

    • AWS RegionɿϦʔδϣϯʢ೚ҙʣ • S3 Bucketɿઌ΄Ͳ࡞੒ͨ͠S3όέοτͷ໊લ • S3 URLɿઌ΄Ͳ࡞੒ͨ͠S3όέοτͷURL • Storage ClassɿSTANDARD
  9. ϓϥάΠϯΛηοτΞοϓ͢Δ $ cd /var/www/vhosts/{INSTANCE_ID} $ wp plugin activate c3-cloudfront-clear-cache $

    wp c3 update distribution_id <DISTRIBUTION_ID> $ wp c3 update access_key <AWS_ACCESS_KEY> $ wp c3 update secret_key <AWS_SECRET_KEY>