Amazon Simple Storage Service (Amazon S3) stores objects inside buckets. A bucket can hold website assets, application uploads, backups, reports, and private documents. The bucket name does not determine who can access its contents: access is controlled by AWS identities and policies, bucket settings, and any organization-level restrictions. For most application storage, begin with a private bucket and grant access to a specific IAM role.
Before You Begin
- An AWS account and permission to create S3 buckets and IAM policies.
- A planned bucket name and AWS Region. Bucket names must be globally unique within the S3 partition.
- An IAM role for the application or workload that needs access. Prefer a role and temporary credentials over long-lived access keys.
- A decision about data retention, versioning, encryption, and whether any content genuinely needs public delivery.
Do not make a bucket public simply because an application needs to upload or download files. A server-side application can access a private bucket using an IAM role. For temporary sharing, consider short-lived pre-signed URLs.
Step 1: Create the S3 Bucket
Sign in to the AWS Management Console and open Amazon S3. Choose Create bucket. Select the AWS Region where the application or data should reside. Choose a globally unique bucket name; avoid putting customer names, email addresses, or other sensitive information in the name.
For a general-purpose application bucket, keep the default Object Ownership setting, Bucket owner enforced. This disables ACLs and makes policies the mechanism for controlling access. Keep the default Block Public Access settings enabled. Review the remaining options, then create the bucket.
Step 2: Keep Block Public Access Enabled
Open the bucket, select the Permissions tab, and review Block public access (bucket settings). For a private application bucket, leave all four Block Public Access controls enabled. These controls prevent public access from being granted through bucket or object ACLs and policies. Account-level or organization-level settings may also apply, and S3 uses the most restrictive effective settings.
If a website or application cannot retrieve an object, do not immediately disable Block Public Access. First determine which identity is making the request and whether it has the required permission. Public access is a separate design decision, not a fix for an incorrectly configured application role.
Step 3: Confirm Object Ownership and ACL Settings
Under Permissions, find Object Ownership. Bucket owner enforced is the recommended default for most modern workloads. It disables ACLs and ensures the bucket-owning account owns objects written to the bucket. Your application should not need to set an object ACL when uploading. If an older application sends an ACL header such as public-read, update the application rather than enabling ACLs without a specific requirement.
Step 4: Configure Default Encryption
S3 automatically applies server-side encryption to new objects. Review the bucket's Properties tab and Default encryption setting. SSE-S3, using Amazon S3 managed keys, is a straightforward default for many workloads. Choose SSE-KMS when you need the additional key-management controls, auditability, or separation of duties provided by AWS Key Management Service. If you use SSE-KMS, the application role and relevant principals also need the appropriate KMS key permissions.
Encryption at rest does not replace access control. Continue to restrict who can list, read, write, and delete objects. Also use HTTPS for requests in transit.
Step 5: Grant an Application Role Only the Access It Needs
Open IAM and locate the role used by your application, such as an EC2 instance profile or another workload role. Attach an identity-based policy that grants only the required S3 actions and only the bucket or object prefix the application uses. Separate listing permissions on the bucket from object permissions on its contents.
The following example allows a role to list only the reports/ prefix and read objects within that prefix. It does not grant upload or delete access. Replace the bucket name with your own. Attach the policy to the application role, not to every user in the account.
Example IAM policy: read-only access to one bucket prefix
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ListReportsPrefix",
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::YOUR-BUCKET-NAME",
"Condition": {
"StringLike": {
"s3:prefix": ["reports", "reports/*"]
}
}
},
{
"Sid": "ReadReportObjects",
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::YOUR-BUCKET-NAME/reports/*"
}
]
}
If the application must upload files, add s3:PutObject only for the required object prefix. Add s3:DeleteObject only if deletion is a real application requirement. Avoid s3:* and Resource: * for routine application access. Remember that permissions can also be limited or denied by permissions boundaries, service control policies, resource control policies, VPC endpoint policies, and explicit Deny statements.
Step 6: Decide Whether a Bucket Policy Is Needed
A bucket policy is a resource-based policy attached to the bucket. You may not need one when an IAM role in the same account already has the required identity policy. Use a bucket policy when you need to grant access to another AWS account or service, enforce a bucket-wide rule, or define a resource-side restriction. Review bucket policies together with IAM policies; the effective result depends on all applicable policies.
A common bucket-wide guardrail is to deny requests that do not use secure transport. Test policy changes carefully and keep an administrative recovery path so you do not accidentally lock out the principals that manage the bucket.
Optional bucket policy statement requiring HTTPS
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyInsecureTransport",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::YOUR-BUCKET-NAME",
"arn:aws:s3:::YOUR-BUCKET-NAME/*"
],
"Condition": {
"Bool": {
"aws:SecureTransport": "false"
}
}
}
]
}
This statement is an additional transport-security guardrail; it does not grant read or write access. Replace the placeholder bucket name and evaluate the effect on every integration before applying it.
Step 7: Test the Permissions
Test from the same role and execution environment that the application will use. Confirm that the role can perform the intended operation on the approved prefix. Then try an operation that should not be allowed, such as reading an object outside that prefix or deleting an object. The expected result is success for the permitted action and AccessDenied for the unauthorized action.
You can also use the IAM policy simulator as an initial check, but a real test using the workload role is important because other policies and service settings can affect the final result. Review CloudTrail events or other configured logging when troubleshooting denied or unexpected requests.
Step 8: Review Versioning, Lifecycle, and Monitoring
Enable S3 Versioning when you need protection against accidental overwrites or deletions. Configure lifecycle rules only after confirming retention and recovery requirements; an expiration rule can permanently remove data after its retention period. Consider aborting incomplete multipart uploads to control storage costs. Use CloudTrail data events, server access logging, and IAM Access Analyzer for S3 where their visibility and cost are appropriate for your workload.
Common Problems
AccessDenied when listing the bucket
The role may be missing s3:ListBucket on the bucket ARN, or a prefix condition may not match the requested prefix. Check the role actually used by the application and inspect any explicit Deny, permissions boundary, organization policy, or VPC endpoint policy.
AccessDenied when reading or uploading an object
Object actions use an object ARN, not the bucket ARN. Check s3:GetObject or s3:PutObject on the correct object prefix. For SSE-KMS, also verify that the principal is allowed to use the KMS key for the operation.
The application tries to set an ACL
With Bucket owner enforced, ACLs are disabled. Remove ACL parameters or headers from the upload request unless you have a documented legacy requirement to enable ACLs.
A bucket policy does not make an object public
Block Public Access settings can override policies that attempt to grant public access. For private application data, keep those controls enabled and use IAM roles or pre-signed URLs instead of making the bucket public.
Final Security Checklist
- The bucket is in the intended AWS Region and has a non-sensitive, globally unique name.
- All four Block Public Access settings remain enabled unless a documented exception has been approved.
- Object Ownership is Bucket owner enforced and ACLs are not used by the application.
- Default server-side encryption is configured and KMS permissions are considered if SSE-KMS is used.
- The application uses an IAM role with only the S3 actions and resource paths it needs.
- Read, write, list, and delete permissions are separated and tested independently.
- Versioning, lifecycle, retention, logging, and recovery settings match the data requirements.