{"id":17,"date":"2014-02-18T12:52:42","date_gmt":"2014-02-18T04:52:42","guid":{"rendered":"http:\/\/vinta.ws\/code\/?p=17"},"modified":"2026-03-17T01:08:24","modified_gmt":"2026-03-16T17:08:24","slug":"granting-access-to-a-single-s3-bucket-using-amazon-iam","status":"publish","type":"post","link":"https:\/\/vinta.ws\/code\/granting-access-to-a-single-s3-bucket-using-amazon-iam.html","title":{"rendered":"Grant Access to a Single S3 Bucket via Amazon IAM"},"content":{"rendered":"<p>Create an IAM user to only allow access to specific resources.<\/p>\n<p>Go to Users &gt; Attach User Policy &gt; Policy Generator on the web console.<\/p>\n<p>ref:<br \/>\n<a href=\"https:\/\/console.aws.amazon.com\/iam\/home?#users\">https:\/\/console.aws.amazon.com\/iam\/home?#users<\/a><\/p>\n<h2>Allow Full Access to Certain Buckets<\/h2>\n<p>Full access to single bucket:<\/p>\n<pre class=\"line-numbers\"><code class=\"language-json\">{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": \"s3:*\",\n      \"Resource\": [\n        \"arn:aws:s3:::files.albedo.one\",\n        \"arn:aws:s3:::files.albedo.one\/*\"\n      ]\n    }\n  ]\n}<\/code><\/pre>\n<p>For BackWPup, a WordPress plugin:<\/p>\n<pre class=\"line-numbers\"><code class=\"language-json\">{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Sid\": \"VisualEditor0\",\n      \"Effect\": \"Allow\",\n      \"Action\": [\"s3:ListBucket\"],\n      \"Resource\": \"arn:aws:s3:::*\"\n    },\n    {\n      \"Sid\": \"VisualEditor1\",\n      \"Effect\": \"Allow\",\n      \"Action\": [\"s3:CreateBucket\", \"s3:DeleteObject\"],\n      \"Resource\": [\n        \"arn:aws:s3:::files.vinta.ws\",\n        \"arn:aws:s3:::files.vinta.ws\/*\",\n        \"arn:aws:s3:::vinta-ws-backup\",\n        \"arn:aws:s3:::vinta-ws-backup\/*\"\n      ]\n    },\n    {\n      \"Sid\": \"VisualEditor2\",\n      \"Effect\": \"Allow\",\n      \"Action\": [\"s3:Get*\", \"s3:List*\", \"s3:Put*\"],\n      \"Resource\": [\n        \"arn:aws:s3:::files.vinta.ws\",\n        \"arn:aws:s3:::files.vinta.ws\/*\",\n        \"arn:aws:s3:::vinta-ws-backup\",\n        \"arn:aws:s3:::vinta-ws-backup\/*\"\n      ]\n    }\n  ]\n}<\/code><\/pre>\n<h2>Only Allow Get\/Put Objects<\/h2>\n<pre class=\"line-numbers\"><code class=\"language-json\">{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": [\"s3:ListBucket\", \"s3:ListAllMyBuckets\"],\n      \"Resource\": \"arn:aws:s3:::*\"\n    },\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": [\"s3:GetObject\", \"s3:PutObject\"],\n      \"Resource\": [\"arn:aws:s3:::metadata.vinta.ws*\"]\n    }\n  ]\n}<\/code><\/pre>\n<h2>S3 Storage Lens<\/h2>\n<pre class=\"line-numbers\"><code class=\"language-json\">{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Sid\": \"VisualEditor0\",\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"s3:GetStorageLensConfiguration\",\n        \"s3:GetStorageLensDashboard\"\n      ],\n      \"Resource\": \"arn:aws:s3:*:*:storage-lens\/*\"\n    },\n    {\n      \"Sid\": \"VisualEditor1\",\n      \"Effect\": \"Allow\",\n      \"Action\": \"s3:ListStorageLensConfigurations\",\n      \"Resource\": \"*\"\n    }\n  ]\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Create AN IAM user to only allow to access specific resources.<\/p>\n","protected":false},"author":1,"featured_media":765,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38,116],"tags":[16,17],"class_list":["post-17","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-about-devops","category-about-web-development","tag-amazon-web-services","tag-aws-s3"],"_links":{"self":[{"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/posts\/17","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/comments?post=17"}],"version-history":[{"count":0,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/posts\/17\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/media\/765"}],"wp:attachment":[{"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/media?parent=17"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/categories?post=17"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/tags?post=17"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}