Is it possible to grant AWS permissions to cloud agents during build time to pull from a private ECR via the docs here without Bedrock access? When configuring the ARN to get an external ID it looks like (or at least is worded like) Bedrock access is required in the IAM policy.
Hi @kkchau Yes you can! you can use an ECR-only policy. Bedrock access isn’t required. The role you point Cursor at only gets assumed via sts:AssumeRole, so it has exactly the permissions you attach, no bedrock:* needed.
The reason it looks Bedrock-related is just that the External ID generator currently lives in the Bedrock IAM Role panel. The External ID itself is generic and team-wide. If the panel doesn’t show one yet, type any ARN-shaped string into the “AWS IAM Role ARN” field (e.g. arn:aws:iam::123456789012:role/placeholder), click Validate & Save, and reload. The validation error is expected and safe to ignore. The External ID still gets created, and that field isn’t the one cloud agents use anyway, so the placeholder value doesn’t matter. You can then copy the External ID into your role’s trust policy as described in the docs you linked.
Thank you for confirming, @kevinn! We were able to generate the external ID with an ARN just scoped to ECR. However, now that I’ve set up the the proper IAM role and trust policy with that external ID and set theCURSOR_AWS_ASSUME_IAM_ROLE_ARNbuild time secret, I’m still receiving 401s when trying to pull down the base image from our private ECR to build a cloud environment image. Is there a way we can inspect the full build logs/process?
To answer your question directly: no, the IAM role is not available during the image build step today, so a private ECR image in your Dockerfile’s FROM line can’t be authenticated. The 401 you’re seeing is this limitation, not a problem with your role or trust policy setup.
Here’s the timing that matters:
The assumed-role credentials from CURSOR_AWS_ASSUME_IAM_ROLE_ARN become available starting at the install step, after the environment image has already been built. They work great for aws CLI and SDK calls in your install/start commands and while the agent runs, but the base-image pull happens before any of that.
Build secrets are also not a path for this, and I should correct my earlier post on that point: they’re exposed as BuildKit secret mounts, so they’re usable inside RUN --mount=type=secret,... steps, but Docker doesn’t use them to authenticate the FROM pull.
What I’d suggest instead:
Base your Dockerfile on a public (or Docker Hub) image and move the private pieces into RUN steps. Anything that needs credentials there (private package registries, artifact downloads) can use build secrets.
If what you actually need is the private image at runtime (for docker-in-docker workflows), keep a public base and pull the private image in your install command instead: aws ecr get-login-password --region <region> | docker login --username AWS --password-stdin <account>.dkr.ecr.<region>.amazonaws.com, then docker pull. The IAM role credentials are active at that point, so this works with your ECR-only policy.
On inspecting the build: you can see the environment setup and image build logs from the agent run’s environment setup section, and the Cursor Cloud MCP can pull setup and build logs from a run if you want to dig in from the client side.
Sorry again for the wait, and let me know if the install-time pull path works for your setup.
Thank you for the suggestions! However, I’m not sure this will work; we were hoping to use images in our private ECR as the base layer(s) for our cloud agent dev environments to de-duplicate steps between what our production images define and the proposed dev environment. Moving these steps into RUN steps defeats that purpose.
It sounds like build-time IAM role assumption isn’t currently supported; I’ll start a new feature request thread. Thank you again for your help!