{"id":257,"date":"2017-08-24T01:49:27","date_gmt":"2017-08-24T01:49:27","guid":{"rendered":"http:\/\/info.juliusgoh.life\/?p=257"},"modified":"2018-01-09T04:56:46","modified_gmt":"2018-01-09T04:56:46","slug":"aws-sdk","status":"publish","type":"post","link":"https:\/\/info.juliusgoh.life\/?p=257","title":{"rendered":"AWS SDK (PHP)"},"content":{"rendered":"<p>Hi, Today i am gonna talk about how to use SDK provided by aws (PHP).<br \/>\nFor aws SDK, they support few kind of languages such as Php, Android, IOS , Java, Python. For all the available language for sdk , <a href=\"https:\/\/aws.amazon.com\/tools\/\">Click Here<\/a><\/p>\n<p>You will have to import aws sdk files there are three kind of method based on this <a href=\"http:\/\/docs.aws.amazon.com\/aws-sdk-php\/v3\/guide\/getting-started\/basic-usage.html#including-the-sdk\">link <\/a><br \/>\nP\/S :- Php including method only<br \/>\n<\/p>\n<p>And Here are some codes to show how to use the sdk.<\/p>\n<pre>\r\nrequire \"AWS\/aws-autoloader.php\";\r\n\r\n$s3 = new Aws\\S3\\S3Client([\r\n    'version' => 'latest',\r\n    'region'  => 'ap-southeast-2'\r\n]);\r\n\r\n$result = $s3->listBuckets();\r\nprint_r($result);\r\n<\/pre>\n<p>You&#8217;ll be wondering Why i do not have to pass the access and secret key into the functions, that is because in my case, i am using the access key and secret key as an enviroment variable. This is the best and most secure of handling credentials. AWS SDK will find enviroment variables (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY ).<\/p>\n<p>On the other hand you can also do this:<\/p>\n<pre>\r\nrequire \"AWS\/aws-autoloader.php\";\r\n\r\n$s3 = new Aws\\S3\\S3Client([\r\n    'version'     => 'latest',\r\n    'region'      => 'ap-southeast-2',\r\n    'credentials' => array(\r\n                     'key'=>'YOUR_AWS_ACCESS_KEY_ID',\r\n                     'secret'=>'YOUR_SECRET_ACCESS_KEY'\r\n                      )\r\n]);\r\n\r\n$result = $s3->listBuckets();\r\nprint_r($result);\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Hi, Today i am gonna talk about how to use SDK provided by aws (PHP). For aws SDK, they support few kind of languages such as Php, Android, IOS , Java, Python. For all the available language for sdk , Click Here You will have to import aws sdk files there are three kind of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,2,4],"tags":[],"_links":{"self":[{"href":"https:\/\/info.juliusgoh.life\/index.php?rest_route=\/wp\/v2\/posts\/257"}],"collection":[{"href":"https:\/\/info.juliusgoh.life\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/info.juliusgoh.life\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/info.juliusgoh.life\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/info.juliusgoh.life\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=257"}],"version-history":[{"count":7,"href":"https:\/\/info.juliusgoh.life\/index.php?rest_route=\/wp\/v2\/posts\/257\/revisions"}],"predecessor-version":[{"id":265,"href":"https:\/\/info.juliusgoh.life\/index.php?rest_route=\/wp\/v2\/posts\/257\/revisions\/265"}],"wp:attachment":[{"href":"https:\/\/info.juliusgoh.life\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/info.juliusgoh.life\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=257"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/info.juliusgoh.life\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}