{"id":524,"date":"2019-01-21T18:28:55","date_gmt":"2019-01-21T15:28:55","guid":{"rendered":"https:\/\/artem.services\/?p=524"},"modified":"2019-01-21T20:02:14","modified_gmt":"2019-01-21T17:02:14","slug":"aws-send-to-s3-bucket-file-via-curl","status":"publish","type":"post","link":"https:\/\/artem.services\/?p=524","title":{"rendered":"AWS &#8212; \u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0444\u0430\u0439\u043b\u0430 \u0432 S3 Bucket \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f cURL"},"content":{"rendered":"<p><img loading=\"lazy\" class=\"size-full wp-image-214 aligncenter\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/AWS-Logo.png\" alt=\"\" width=\"975\" height=\"450\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/AWS-Logo.png 975w, https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/AWS-Logo-300x138.png 300w, https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/AWS-Logo-768x354.png 768w, https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/AWS-Logo-954x440.png 954w\" sizes=\"(max-width: 975px) 100vw, 975px\" \/><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# AWS S3 Credentials\r\nS3_BUCKET=&quot;YOUR_S3_BUCKET_NAME&quot;\r\nS3_ACCESS_KEY=&quot;YOUR_ACCESS_KEY&quot;\r\nS3_SECRET_KEY=&quot;YOUR_SECRET_KEY&quot;\r\n\r\nFILE_NAME=&quot;test.tar.gz&quot;\r\n\r\n# SENDING\r\n\r\ndate=&quot;$(date +%Y%m%d)&quot;\r\ndateFormatted=&quot;$(date -R)&quot;\r\nrelativePath=&quot;\/${S3_BUCKET}\/${FILE_NAME}&quot;\r\ncontentType=&quot;application\/octet-stream&quot;\r\nstringToSign=&quot;PUT\\n\\n${contentType}\\n${dateFormatted}\\n${relativePath}&quot;\r\nsignature=&quot;$(echo -en ${stringToSign} | openssl sha1 -hmac ${S3_SECRET_KEY} -binary | base64)&quot;\r\ncurl -X PUT -T &quot;${FILE_NAME}&quot; \\\r\n-H &quot;Host: ${S3_BUCKET}.s3.amazonaws.com&quot; \\\r\n-H &quot;Date: ${dateFormatted}&quot; \\\r\n-H &quot;Content-Type: ${contentType}&quot; \\\r\n-H &quot;Authorization: AWS ${S3_ACCESS_KEY}:${signature}&quot; \\\r\nhttp:\/\/${S3_BUCKET}.s3.amazonaws.com\/${FILE_NAME}\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[24],"tags":[25,133,35],"_links":{"self":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/524"}],"collection":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=524"}],"version-history":[{"count":6,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/524\/revisions"}],"predecessor-version":[{"id":533,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/524\/revisions\/533"}],"wp:attachment":[{"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}