amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

Why does "amplify pull" require s3:PutObject permissions?

Open mrgrue opened this issue 6 years ago • 5 comments

I'm using amplify-cli version 4.27.3 on MacOS.

I've been trying to come up with a security policy for the least amount of access needed for developers to use Amplify. I want to make sure they can only pull changes, not push, so I stripped out all the update, delete, add, create, and so forth that I found here:

https://docs.amplify.aws/cli/usage/iam

It's a little out of date; for example, I had to add a bunch of stuff related to Pinpoint mobiletargeting.

The thing that surprised me, though, was that I had to add s3:PutObject for "amplify pull" to work. Without that action, I got access denied errors.

Why would Amplify need write access to S3 for an "amplify pull"?

Thanks!

mrgrue avatar Sep 16 '20 21:09 mrgrue

The IAM policies documented here https://docs.amplify.aws/cli/usage/iam are for all the Amplify CLI commands as a whole to properly function, not just for one command such as amplify pull. The amplify pull command's workflow depends on the current status of the project and user intention (specified with command line parameters). And it uses the project's deployment S3 bucket to store/update project artifacts so it can function properly. Some workflows of the amplify pull command, such as attaching an existing backend to a new frontend project among others, needs to upload the updated metadata files to the deployment bucket, that's why the s3:PutObject is needed.

UnleashedMind avatar Sep 16 '20 21:09 UnleashedMind

Ok, that makes sense. It's still a little concerning that someone that I'm trying to restrict to read-only access to the project is modifying files just as part of the pull. Are there specific S3 objects that "amplify pull" needs to modify that I can restrict access to?

mrgrue avatar Sep 16 '20 21:09 mrgrue

it's the deployment bucket, you can find its name in the amplify/team-provider-info.json file for each of the backend envs.

UnleashedMind avatar Sep 16 '20 21:09 UnleashedMind

Thanks for your help!

mrgrue avatar Sep 17 '20 02:09 mrgrue

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

github-actions[bot] avatar May 25 '21 21:05 github-actions[bot]