Explore how to work with Amazon S3 access points by creating a demo bucket, uploading files, and configuring access controls for different user groups.
In this guide, explore how to work with Amazon S3 access points by creating a demo bucket, uploading files, simulating multiple users, and configuring granular access controls. We’ll cover creating access points for different user groups such as developers and finance, and demonstrate how access point policies work alongside bucket policies.
Begin by creating a demo S3 bucket named KK-AccessPoint with default settings. Once the bucket is created, upload a demo file (for example, beach.jpg) to test file accessibility.
As the bucket owner, click the Open button after uploading to verify access to the file.
To simulate different users accessing the S3 bucket, open separate browser tabs. For instance, use:• Blue tab – User One (bucket owner)
• Green tab – User Two
• Yellow tab – User Three
Next, validate the user permissions in the IAM Management Console. In this demo, User Three has CloudShell access only and no permissions to interact with S3 buckets.
AWS CloudShell, with the AWS CLI pre-installed, allows you to run commands without setting up a local CLI environment. While testing, you might observe that although the bucket owner can list bucket contents, Users Two and Three receive a “403 Forbidden” error when trying to copy the file.For example, in a CloudShell session as the bucket owner:
Copy
Ask AI
[cloudshell-user@ip-10-2-30-244 ~]$ aws s3 ls2023-04-07 02:36:13 kk-access-point[cloudshell-user@ip-10-2-30-244 ~]$ aws s3 ls s3://kk-access-point/2023-04-07 02:27:37 2897941 beach.jpg[cloudshell-user@ip-10-2-30-244 ~]$ aws s3 cp s3://kk-access-point/beach.jpg .fatal error: An error occurred (403) when calling the HeadObject operation: Forbidden[cloudshell-user@ip-10-2-30-244 ~]$
Attempting the same command under User Two or User Three’s session will produce a similar forbidden error, confirming that initially only the bucket owner has access.When re-testing as the main user, the same error persists:
Copy
Ask AI
[cloudshell-user@ip-10-2-30-244 ~]$ aws s3 ls2023-04-07 07:26:13 kk-access-point[cloudshell-user@ip-10-2-30-244 ~]$ aws s3 cp s3://kk-access-point/beach.jpg .fatal error: An error occurred (403) when calling the HeadObject operation: Forbidden
Access points allow you to delegate access control to specific groups. In this demo, we’ll create two access points — one for developers and one for finance.
Access point policies are similar to bucket policies but reference the access point ARN rather than the bucket ARN. Below is a sample access point policy:
Note the following:
• The policy specifies a principal and allowed actions.
• The resource section references the access point ARN, distinctly different from a typical bucket ARN.
Ensure that permissions granted in an access point policy are also allowed by the underlying bucket. You can either delegate control from the bucket or include the access point policy in the bucket policy.
To delegate control from the bucket, modify your bucket policy as shown below:
(Be sure to update the ARNs and access point names to reflect your specific configuration.) After making these changes, save the policies and verify the updated configuration on the access point’s Permissions tab.
With the proper policies in place, test the new access points using the AWS CLI. Instead of addressing the bucket directly, use the ARN of the access point.For example, to list objects through the developers access point:
Copy
Ask AI
aws s3 ls s3://arn:aws:s3:us-east-1:841860927337:accesspoint/developers
Assuming the policy is configured correctly, you will see the objects (e.g., beach.jpg). To download the file using the access point:
You can also test uploads by copying a new file (e.g., test1) into the bucket via the designated access point. This customized approach provides greater control over how different user groups interact with your S3 bucket.
By leveraging S3 access points, you can delegate access control to distinct user groups—such as developers and finance—simplifying permissions management and enhancing security. Each access point features its own ARN and policy, enabling granular control over data access within a shared S3 bucket. For further details on S3 best practices and advanced configurations, refer to the AWS S3 Documentation.Happy cloud computing!