


Cyberduck s3 specific bucket full#
Even though both the role and the user have full “s3:*” permissions, the bucket policy negates access to the bucket for anyone that has not assumed the role.

The role is able to access both buckets, but the user can access only the bucket without the bucket policy attached to it. Both the IAM user and the role can access buckets in the account.The S3 bucket policy restricts access to only the role.The IAM user’s policy and the role’s user policy grant access to “s3:*”.The following diagram illustrates how this works for a bucket in the same account. The solution in this post uses a bucket policy to regulate access to an S3 bucket, even if an entity has access to the full API of S3. You can also use this approach to limit access to a bucket with a high-level security need. You can use this approach, for example, to configure a bucket for access by instances within an Auto Scaling group. Even if another user in the same account has an Admin policy or a policy with s3:*, they will be denied if they are not explicity listed. In this blog post, I show how you can restrict S3 bucket access to a specific IAM role or user within an account using Conditions instead of with the NotPrincipal element. Normally you would specify a wildcard where the variable string would go, but this is not allowed in a Principal or NotPrincipal element. When using the NotPrincipal element, you must include both ARNs for this approach to work, and the second of these ARNs should include a variable name. The role ARN is the identifier for the IAM role itself and the assumed-role ARN is what identifies the role session in the logs. However, this inverted logic approach proves problematic with IAM roles because the role’s Principal value is composed of two Amazon Resource Names (ARNs), the role ARN and the assumed-role ARN. This element creates an explicit Deny for any user that is not listed in its value. Rather than specify the list of users whose access you want to block, you can invert the logic and leverage the NotPrincipal element in the bucket policy’s Deny statement. If a new IAM user were added to the account with “s3:*” for the Action, the user would be granted access to the bucket. The drawback with this approach is the required maintenance of the bucket policy. In general, they attempt to do this the same way that they would with an IAM user: use a bucket policy to explicitly Deny all Principals (users and roles) to which they do not want to grant access. I am a cloud support engineer here at AWS, and customers often ask me how they can limit Amazon S3 bucket access to a specific AWS Identity and Access Management (IAM) role. April 2, 2021: In the section “Granting cross-account bucket access to a specific IAM role,” we’ve updated the second policy to fix an error.
