1 Answer
- Newest
- Most votes
- Most comments
0
Based on the error message and your code, it appears you're encountering a permission issue when trying to assume a role. The error indicates that the identity "AmplifyTestRole/AmplifyHostingCompute-app" is trying to assume the same role "AmplifyTestRole" but doesn't have permission to do so.
There are a few key issues to check:
- Trust Relationship Policy: The IAM role you're trying to assume needs a trust policy that allows the service or entity to assume it. For Amplify applications, the trust policy should include both the regional Amplify service and the general Amplify service:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": ["amplify.us-east-1.amazonaws.com", "amplify.amazonaws.com"] }, "Action": "sts:AssumeRole" } ] }
-
Circular Role Assumption: The error suggests you might be trying to have a role assume itself, which isn't allowed. The error shows "AmplifyTestRole" trying to assume "AmplifyTestRole" again.
-
IAM Permissions: Ensure that the IAM identity executing the code has the necessary permissions to call
sts:AssumeRolefor the specific role. Your IAM policy should include something like:
{ "Effect": "Allow", "Action": "sts:AssumeRole", "Resource": "arn:aws:iam::account_id_number:role/AmplifyTestRole" }
- GitHub Repository Access: If you're using GitHub with Amplify, verify that the AWS Amplify GitHub App has access to your repository. Sometimes deployments fail with "Unable to assume specified IAM Role" errors when the GitHub App loses access to the repository.
To resolve this issue:
- Review and update the trust policy of the role
- Ensure you're not trying to have a role assume itself
- Verify the IAM permissions of the executing identity
- Check GitHub repository access if applicable
- Consider invalidating the cache or deploying a fresh version of the app if the issue persists
Sources
Amplify Error - Unable to assume IAM Role | AWS re:Post
Troubleshoot IAM roles - AWS Identity and Access Management
Relevant content
asked a year ago
