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.

Caio Rodrigues Caio Rodrigues I'm a full-stack developer focused on building practical and scalable web applications. My main experience is with **React, TypeScript, and modern frontend architectures**, where I prioritize clean code, component reusability, and maintainable project structures. I have strong experience working with **dynamic forms, state management (Redux / React Hook Form), and complex data-driven interfaces**. I enjoy solving real-world problems by turning ideas into reliable software that companies can actually use in their daily operations. Beyond coding, I care about **software quality and architecture**, following best practices for componentization, code organization, and performance optimization. I'm also comfortable working across the stack when needed, integrating APIs, handling business logic, and helping transform prototypes into production-ready systems. My goal is always to deliver solutions that are **simple, efficient, and genuinely useful for the people using them.** Sage Fulcher Sage Fulcher Hey I'm Sage! Im a Boston area software engineer who grew up in South Florida. Ive worked at a ton of cool places like a telehealth kidney care startup that took part in a billion dollar merger (Cricket health/Interwell health), a boutique design agency where I got to work on a ton of exciting startups including a photography education app, a collegiate Esports league and more (Philosophie), a data analytics as a service startup in Cambridge (MA) as well as at Phillips and MIT Lincoln Lab where I designed and developed novel network security visualizations and analytics. I've been writing code and furiously devoted to using computers to make people’s lives easier for about 17 years. My degree is in making computers make pretty lights and sounds. Outside of work I love hip hop, the Celtics, professional wrestling, magic the gathering, photography, drumming, and guitars (both making and playing them) 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 : ) Meïr Ankri Meïr Ankri Full-stack developer specializing in React / Next.js / Node.js with 6+ years of experience. I've worked across various sectors including automotive (Reezocar/Société Générale), healthcare (Medical Link SaaS), and e-commerce (Glasman). I build web apps end-to-end, from architecture to production, with a focus on scalability, performance, and code quality. I also mentor junior developers and contribute to technical decisions and code reviews. prajwalfullstack prajwalfullstack Hi Im a full stack developer, a vibe coded MVP to Market ready product, I'm here to help Alvin Voo Alvin Voo I’ve watched the tech landscape evolve over the last decade—from the structured days of Java Server Pages to the current "wild west" of Agentic-driven development. While AI can "vibe" a frontend into existence, I specialize in the architecture that keeps it from collapsing. My expertise lies in the critical backend infrastructure: the parts that must be fast, secure, and scalable. I thrive on high-pressure environments, such as when I had only three weeks to architect and launch an Ethereum redemption system with minimal prior crypto knowledge, turning it into a major revenue stream. What I bring to your project: Forensic Debugging: I don't just "patch" bugs; I use tools like Datadog and Explain Analyzers to map out bottlenecks and resolve root causes—like significantly reducing memory usage by optimizing complex DB joins. Full-Stack Context: Deep experience in Node.js and React, ensuring backends play perfectly with mobile and web teams. Sanity in the Age of AI: I bridge the gap between "best practices" and modern speed, ensuring your project isn't just built fast, but built to last. Matthew Butler Matthew Butler Systems Development Engineer @ Amazon Web Services AUXLE AUXLE I am a Full Stack Developer experienced in building Websites, Web apps and Cross Platform Mobile Apps for Startups and Companies. Mehdi Ben Haddou Mehdi Ben Haddou - Founder of Chessigma (1M+ users) & many small projects - ex Founding Engineer @Uplane (YC F25) - ex Software Engineer @Amazon and @Booking.com Franck Plazanet Franck Plazanet I am a Strategic Engineering Leader with over 8 years of experience building high-availability enterprise systems and scaling high-performing technical teams. My focus is on bridging the gap between complex technology and business growth. Core Expertise: 🚀 Leadership: Managing and coaching teams of 15+ engineers, fostering a culture of accountability and continuous improvement. 🏗️ Architecture: Enterprise Core Systems, Multi-system Integration (ERP/API/ETL), and Core Database Structure. ☁️ Cloud & Scale: AWS Expert; architected systems handling 10B+ monthly requests and managing 100k+ SKUs. 📈 Business Impact: Aligning tech strategy with P&L goals to drive $70k+ in monthly recurring revenue. I thrive on "out-of-the-box" thinking to solve complex technical bottlenecks and am always looking for ways to use automation to improve business productivity.

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