-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Region us-east-1 Has IAM Role Issues #1726
Comments
Hi @bebopinbebop 👋 , thanks for reaching out and providing detailed information. Based on the error message from the build logs, the root cause appears to be either of the following:
Could you verify the following?
|
Hey Jay! Thanks for taking the time to answer me, didn't think it would be that quick. Okay so I think I got the Role attached for service roles here, which is what I did before: and my trust relationship already included the parameters you laid out, I just added more because I was not sure if I was covering all my bases:
I did try copying and entering what you gave me and it did not work, unfortunately. The only thing I can think of is either I'm blind to AWS Roles or I'm missing a setting for us-east-1. What would you suggest? |
Alright, I really need help here, cause I feel like I've exhausted all of my ability. I created a new user (user_bob) and gave them the following Permission Policies:
I also added a Tag of "Type":"FunID", as explained in the Stack Overflow here: https://medium.com/@kamal.maiti/you-might-be-clueless-as-to-why-aws-assume-role-isnt-working-despite-being-correctly-set-up-1b3138519c07 Then I edited the Service Role "AmplifyConsoleServiceRole-AmplifyRole" to include:
The Service Role was given the trust relationship of: {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [
"amplify.amazonaws.com",
"amplify.us-east-1.amazonaws.com"
],
"AWS": "arn:aws:iam::<AWS_ID>:user/user_bob"
},
"Action": "sts:AssumeRole"
}
]
} I explicitly added the user's ARN so that it was a direct relationship to remove ambiguity. Then I attached the Service Role to my Amplify app, as proof in the image: After that, I logged into the AWS console using user_bob credentials and tried running the app in Amplify, to no success. 2024-07-13T02:16:15.149Z [ERROR]: !!! Unable to assume specified IAM Role. Please ensure the selected IAM Role has sufficient permissions and the Trust Relationship is configured correctly.
2024-07-13T02:16:15.241Z [INFO]: # Starting environment caching...
2024-07-13T02:16:15.241Z [INFO]: # Environment caching completed I think there is some very specific setting I am missing or there is a service error. Please help, I'm lost. |
Hi @bebopinbebop, thanks for sharing the additional details. To expedite the troubleshooting process, I can jump on a call with you to have a screen sharing session to debug this error. Can you share your availability via a DM on our community discord server?. My username is |
Okay thanks! Just added you |
To summarize our discussion, the root cause of the deployment failures appeared to be the following:
|
Yeah, I have it working properly now, thanks to you! So what we did, for those reading up on this chain, is that instead of following the push instructions from the repo (https://github.com/aws-samples/aws-plaid-demo-app) where it would create a data set and then construct the Amplify backend, we just created a new project in Amplify and then took the fork that I had in my repo. From there, we made it a monorepo and it was able to deploy, but only after ensuring that my Git was properly synced to Amplify. The major thing that fixed this was that the project repo was from 2022, but with the updates for SAM and Amplify, rebuilding this project in Amplify V2 has worked out the issues. That and modifying the
Last but not least during the SAM build process, my previous deployment created a Secret in my Secret Manager that when after re-deploying the code under a new build process, it was holding back the new deployment. That's because the code was autogenerating a Secret that "already existed" under a previous build. To fix that, you have to change the name of the Credential variable from:
to something else so that the Secret Manager can save it. Since it taked 7 ays to delete a secret, it's better to create a new one and schedule the old one for the 7 day deletion. I just renamed it to something else like:
I got the app to work: |
@bebopinbebop It's great to hear that your Amplify app has been deployed successfully! Thank you for sharing the detailed steps you followed to implement the Plaid demo app. These steps can be helpful for other developers or community members. I will now close this thread. |
Environment information
Description
I am testing out the AWS Plaid tutorial found here:
https://aws.amazon.com/blogs/apn/how-to-build-a-fintech-app-on-aws-using-the-plaid-api/
and I was able to create my change-set and everything to Amplify, but when I went to the Frontend URL, and saw that my SAM was not running.
I got to deploy it and I got this error in the Build Console:
2024-07-09T07:05:27.925Z [ERROR]: !!! Unable to assume specified IAM Role. Please ensure the selected IAM Role has sufficient permissions and the Trust Relationship is configured correctly.
2024-07-09T07:05:28.107Z [INFO]: # Starting environment caching...
2024-07-09T07:05:28.107Z [INFO]: # Environment caching completed
After doing some research, I found this post that says solves the issue:
aws-amplify/amplify-hosting#828
Which they explained could be resolved by editing a service role for the Amplify instance:
https://docs.aws.amazon.com/amplify/latest/userguide/how-to-service-role-amplify-console.html
Looking further down the Github post, you also see that someone was not able to make the Role policy they made work because the trust relationship must be defined in a specific way:
https://stackoverflow.com/questions/65287024/permission-problem-accessing-codecommit-repository-during-build-phase
A new Role was made called: AmplifyConsoleServiceRole-AmplifyRole
in my IAM with the two tags:
I then also added the Role to the following policies:
and I edited the Trust Relationship as:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [
"amplify.amazonaws.com",
"amplify.us-east-1.amazonaws.com",
"codecommit.amazonaws.com"
]
},
"Action": "sts:AssumeRole",
"Condition": {
"ArnLike": {
"aws:SourceArn": "arn:aws:amplify:us-east-1:<AWS_ID>:apps/*"
},
"StringEquals": {
"aws:SourceAccount": "<AWS_ID>"
}
}
}
]
}
where <AWS_ID> is my AWS number.
Looking at the blogs like the ones above and this here:
https://medium.com/@kamal.maiti/you-might-be-clueless-as-to-why-aws-assume-role-isnt-working-despite-being-correctly-set-up-1b3138519c07
It seems that the region I'm in is the problem or I am not properly defining the Trust Relationship for the Service Role.
Forgive the noob Github post, I'm new to asking for help.
Thanks
The text was updated successfully, but these errors were encountered: