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

月額10円から作るServerLess Website

月額10円から作るServerLess Website

JAWS-UG福岡 2016/3/21「また濃い目にAWSの話をしてみよう」でお話した資料です。

Kunihiro Morita

March 21, 2016
Tweet

More Decks by Kunihiro Morita

Other Decks in Technology

Transcript

  1. // Cognito AWS.config.region = 'ap-northeast-1'; // Region AWS.config.credentials = new

    AWS.CognitoIdentityCredentials({ IdentityPoolId: 'ap-northeast-1:12345679-1234-1234-1234-123456789012', }); AWS.config.credentials.get(); // S3 Put var s3 = new AWS.S3({ params: { Bucket: bucket } }); s3.putObject({ Key: now.getTime() + '.json', ContentType: 'application/json', Body: blob }, function(err, data) { if (data !== null) { alert('Success'); } else { alert('Fail'); } } ); 2016/3/21 JAWS-UG෱Ԭ ·ͨೱ͍໨ʹAWSͷ࿩Λͯ͠ΈΑ͏ 12
  2. ิ଍ • ͓໰͍߹Θͤσʔλஔ͖৔ͷS3όέοτʹ͸CORSઃఆ • S3 PUT߈ܸ͞Εͨ͘ͳ͍ͷͰ͔ͬ͠Γ੍ݶ <?xml version="1.0" encoding="UTF-8"?> <CORSConfiguration

    xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <CORSRule> <AllowedOrigin>http://hoge.com</AllowedOrigin> <AllowedMethod>PUT</AllowedMethod> <AllowedHeader>*</AllowedHeader> </CORSRule> </CORSConfiguration> 2016/3/21 JAWS-UG෱Ԭ ·ͨೱ͍໨ʹAWSͷ࿩Λͯ͠ΈΑ͏ 13