Add user for a specific S3 bucket

In order to add an IAM user to an S3 bucket in AWS, you have to create a policy and attach to the user.

  1. At first, make sure you’re a root user of AWS.
  2. Go through the IAM panel.
  3. Then click on the ‘Policies’ menu on the left sidebar.
  4. 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/*"
            }
        ]
    }
  5. Review and save the policy.
  6. Then you have to attach the newly created policy to your new or existing IAM user.
  7. That’s all.
Posted in: AWS