Amplify publish failed - Missing cloudfront permission for user
See original GitHub issueBefore opening, please confirm:
- I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- I have searched for duplicate or closed issues.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- I have removed any sensitive information from my code snippets and submission.
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v17.3
Amplify CLI Version
7.6.19
What operating system are you using?
Macos
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
None
Amplify Categories
hosting
Amplify Commands
publish
Describe the bug
Created user through config walkthrough. This created a user with [AdministratorAccess-Amplify] policy. Pulled existing backend. Add hosting using S3 and production.
Publish started for S3AndCloudFront An error occurred during the publish operation: User: arn:aws:iam::xxx:user/xx is not authorized to perform: cloudfront:GetCloudFrontOriginAccessIdentity on resource: arn:aws:cloudfront::xx:origin-access-identity/xx because no identity-based policy allows the cloudfront:GetCloudFrontOriginAccessIdentity action
Added CloudFrontFullAccess policy to user and the publish succeeded.
Expected behavior
No error.
Reproduction steps
amplify configure create new user amplify pull existing amplify add hosting s3 production amplify publish
GraphQL schema(s)
# Put schemas below this line
Log output
# Put your logs below this line
Additional information
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Amplify publish causes AccessDenied error - Stack Overflow
I suspect this has something to do with the S3 bucket not being in the default us-east-1 region and amplify not setting up...
Read more >Resolve Access Denied errors from a CloudFront distribution ...
To troubleshoot Access Denied errors, first determine if your distribution's origin domain name is an S3 website endpoint or an S3 REST API ......
Read more >Hosting - Overview - AWS Amplify Docs
This command walks through the steps to configure the different sections of the resources used in hosting, including S3, CloudFront, and publish ignore....
Read more >Troubleshoot the 403 Forbidden error when uploading files ...
Permissions are missing for s3:PutObject to add an object or s3:PutObjectAcl to modify the object's ACL. · You don't have permission to use...
Read more >How do I resolve the CloudFront error "No Access ... - YouTube
How do I resolve the CloudFront error "No Access-Control-Allow-Origin header?
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey @ktmdan and @daichi-yamauchi 👋 thanks for raising this! I was able to successfully reproduce by using the following steps:
amplify init -y
using a profile withAdministratorAccess-Amplify
index.html
file atdist/index.html
build
commandamplify add hosting
> s3 PRODamplify publish
As noted this can be mitigated by providing an inline policy to the created IAM user:
Although this policy is available in the managed policy, the condition requires the call to originate from CloudFormation which is causing the CLI to error on publish
Marking as a bug 🙂
A temporary solution to this issue is to manually add the policy on IAM.
The easiest way is to add the following JSON to the inline policy