In order to add an IAM user to an S3 bucket in AWS, you have to create a policy and attach to the user.
- At first, make sure you’re a root user of AWS.
- Go through the IAM panel.
- Then click on the ‘Policies’ menu on the left sidebar.
-
Then create a policy using the following JSON, just make sure you’ve put the proper bucket name.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListAllMyBuckets", "s3:GetBucketLocation" ], "Resource": "*" }, { "Effect": "Allow", "Action": "s3:ListBucket", "Resource": "arn:aws:s3:::mybucket" }, { "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject", "s3:DeleteObject", "s3:PutObjectAcl" ], "Resource": "arn:aws:s3:::mybucket/*" } ] }
- Review and save the policy.
- Then you have to attach the newly created policy to your new or existing IAM user.
- That’s all.