Cursor storage

S3 Access Denied Errors in Cursor-Generated AWS Code

Your Cursor-generated code that interacts with Amazon S3 fails with 403 Access Denied errors when attempting to upload, download, or list objects. The AWS SDK throws AccessDenied exceptions even though you've configured credentials and created the bucket.

S3 permissions are notoriously complex, involving the intersection of IAM policies, bucket policies, ACLs, and encryption settings. Cursor often generates syntactically correct S3 code but with incorrect assumptions about the permission model — using wrong region configurations, missing required permissions in the IAM policy, or assuming public access that's been blocked by default.

The frustration compounds because the same code might work with one AWS account's permissions but fail with another, or work for reads but not writes, or work for small files but fail for multipart uploads.

Error Messages You Might See

AccessDenied: Access Denied An error occurred (403) when calling the PutObject operation: Access Denied SignatureDoesNotMatch: The request signature we calculated does not match AccessDenied: User: arn:aws:iam::123456:user/app is not authorized to perform s3:PutObject KMS.AccessDeniedException: The ciphertext refers to a customer master key that does not exist
AccessDenied: Access DeniedAn error occurred (403) when calling the PutObject operation: Access DeniedSignatureDoesNotMatch: The request signature we calculated does not matchAccessDenied: User: arn:aws:iam::123456:user/app is not authorized to perform s3:PutObjectKMS.AccessDeniedException: The ciphertext refers to a customer master key that does not exist

Common Causes

  • IAM policy too restrictive — The IAM user/role only has s3:GetObject but the code also needs s3:PutObject, s3:ListBucket, or s3:DeleteObject
  • Bucket policy blocks access — The bucket has a restrictive bucket policy that overrides IAM permissions
  • S3 Block Public Access enabled — Default S3 settings block all public access, but Cursor's code tries to set objects as public-read
  • Wrong region configuration — The SDK is configured for us-east-1 but the bucket is in eu-west-1, causing signature mismatches
  • Incorrect ARN in IAM policy — The IAM policy references the bucket ARN without the /* suffix for object-level operations
  • KMS encryption key permissions — The bucket uses KMS encryption and the IAM role doesn't have kms:Decrypt or kms:GenerateDataKey permissions

How to Fix It

  1. Verify IAM permissions — Ensure your IAM policy includes all required actions: s3:PutObject, s3:GetObject, s3:ListBucket, s3:DeleteObject. Use the ARN format arn:aws:s3:::bucket-name for bucket-level and arn:aws:s3:::bucket-name/* for object-level operations
  2. Check bucket region — Verify the region in your SDK config matches the actual bucket region. Find it in the S3 console under bucket Properties
  3. Review Block Public Access settings — If your code uses public-read ACLs, either disable Block Public Access or change the code to use signed URLs instead
  4. Test with AWS CLI first — Run aws s3 cp test.txt s3://your-bucket/ to verify credentials and permissions before debugging code
  5. Check CloudTrail logs — Look at CloudTrail S3 data events to see the exact API call and which policy denied it
  6. Add KMS permissions if encrypted — If the bucket uses SSE-KMS, add kms:Decrypt and kms:GenerateDataKey to the IAM policy for the KMS key ARN

Real developers can help you.

Victor Denisov Victor Denisov Developer Rudra Bhikadiya Rudra Bhikadiya I build and fix web apps across Next.js, Node.js, and DBs. Comfortable jumping into messy code, broken APIs, and mysterious bugs. If your project works in theory but not in reality, I help close that gap. Matt Butler Matt Butler Software Engineer @ AWS Taufan Taufan I’m a product-focused engineer and tech leader who builds scalable systems and turns ideas into production-ready platforms. Over the past years, I’ve worked across startups and fast-moving teams, leading backend architecture, improving system reliability, and shipping products used by thousands of users. My strength is not just writing code — but connecting product vision, technical execution, and business impact. Krishna Sai Kuncha Krishna Sai Kuncha Experienced Professional Full stack Developer with 8+ years of experience across react, python, js, ts, golang and react-native. Developed inhouse websearch tooling for AI before websearch was solved : ) Milan Surelia Milan Surelia Milan Surelia is a Mobile App Developer with 5+ years of experience crafting scalable, cross-platform apps at 7Span and Meticha. At 7Span, he engineers feature-rich Flutter apps with smooth performance and modern UI. As the Co-Founder of Meticha, he builds open-source tools and developer-focused products that solve real-world problems. Expertise: 💡 Developing cross-platform apps using Flutter, Dart, and Jetpack Compose for Android, iOS, and Web. 🖋️ Sharing insights through technical writing, blogging, and open-source contributions. 🤝 Collaborating closely with designers, PMs, and developers to build seamless mobile experiences. Notable Achievements: 🎯 Revamped the Vepaar app into Vepaar Store & CRM with a 2x performance boost and smoother UX. 🚀 Launched Compose101 — a Jetpack Compose starter kit to speed up Android development. 🌟 Open source contributions on Github & StackOverflow for Flutter & Dart 🎖️ Worked on improving app performance and user experience with smart solutions. Milan is always happy to connect, work on new ideas, and explore the latest in technology. Pratik Pratik SWE with 15+ years of experience building and maintaining web apps and extensive BE infrastructure Luca Liberati Luca Liberati I work on monoliths and microservices, backends and frontends, manage K8s clusters and love to design apps architecture Matthew Butler Matthew Butler Systems Development Engineer @ Amazon Web Services Yovel Cohen Yovel Cohen I got a lot of experience in building Long-horizon AI Agents in production, Backend apps that scale to millions of users and frontend knowledge as well.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help

Frequently Asked Questions

Why does my S3 code work locally but fail in production?

Your local AWS CLI likely uses a different IAM user with broader permissions than the production IAM role. Check the production role's permissions in the IAM console and compare them to what the code requires.

Should I make my S3 bucket public to fix Access Denied?

Almost never. Instead, use pre-signed URLs to grant temporary access to specific objects. Generate them server-side with a short expiration (15 minutes to 1 hour) and pass the URL to the client.

Related Cursor Issues

Can't fix it yourself?
Real developers can help.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help