DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Model Context Protocol Vs Agent2Agent: Practical Integration with Enterprise Data
  • Keep Your Application Secrets Secret
  • Adding a Custom Domain and SSL to AWS EC2
  • Build a GitHub Slack Bot With AWS Bedrock and MCP, Part 2

Trending

  • The Missing `bandit` for AI Agents: How I Built a Static Analyzer for Prompt Injection
  • Implementing Observability in Distributed Systems Using OpenTelemetry
  • Every Cache Miss Is a Tiny Tax on Your Performance
  • Mastering Fluent Bit: Beginners' Guide for Contributing to Our CNCF Project Website
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. How to Allow Only HTTPS on an S3 Bucket

How to Allow Only HTTPS on an S3 Bucket

By 
Matt Butcher user avatar
Matt Butcher
·
Oct. 08, 14 · Interview
Likes (0)
Comment
Save
Tweet
Share
17.7K Views

Join the DZone community and get the full member experience.

Join For Free

It is possible to disable HTTP access on S3 bucket, limiting S3 traffic to only HTTPS requests. The documentation is scattered around the Amazon AWS documentation, but the solution is actually straightforward.

All you need to do to block HTTP traffic on an S3 bucket is add a Condition in your bucket's policy. AWS supports a global condition for verifying SSL. So you can add a condition like this:

"Condition": {
  "Bool": {
    "aws:SecureTransport": "true"
  }
}

Here's a complete example:

{
    "Version": "2008-10-17",
    "Id": "some_policy",
    "Statement": [
        {
            "Sid": "AddPerm",
            "Effect": "Allow",
            "Principal": {
                "AWS": "*"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::my_bucket/*",
            "Condition": {
                "Bool": {
                    "aws:SecureTransport": "true"
                }
            }
        }
    ]
}

Now accessing the contents of my_bucket over HTTP will produce a 403 error, while using HTTPS will work fine.

AWS HTTPS

Published at DZone with permission of Matt Butcher. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Model Context Protocol Vs Agent2Agent: Practical Integration with Enterprise Data
  • Keep Your Application Secrets Secret
  • Adding a Custom Domain and SSL to AWS EC2
  • Build a GitHub Slack Bot With AWS Bedrock and MCP, Part 2

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook