- Newest
- Most votes
- Most comments
Hello.
I think you may need to configure a Compute Role rather than a Service Role.
https://aws.amazon.com/jp/blogs/mobile/iam-compute-roles-for-server-side-rendering-with-aws-amplify-hosting/
The issue you're experiencing is related to how IAM roles and credentials are passed between services in AWS Amplify's SSR environment. Let me address your specific questions and provide some guidance.
Root Cause Analysis
The core issue is that the IAM service role you've configured for Amplify isn't properly being assumed by the Lambda functions that power your SSR environment. While your trust relationship includes both amplify.amazonaws.com and lambda.amazonaws.com, there appears to be a disconnect in how these credentials are being passed to the Lambda execution environment.
Addressing Your Questions
- Does Amplify Hosting (SSR) Lambda environment properly pass IAM role credentials?
Based on your logs showing hasContainerCredentials: false, it appears the Lambda environment isn't receiving the container credentials it needs. This suggests the IAM role assumption chain isn't working as expected between Amplify and the Lambda functions it creates for SSR.
- Is there a specific configuration for container credentials?
The issue might be related to the trust relationship configuration. When Amplify creates Lambda functions for SSR, it needs to be able to pass the role to those functions.
- Is this a known limitation?
This appears to be related to the iam:PassRole permission issue. Amplify needs to be able to pass the role to the Lambda service, but there might be a missing permission or trust relationship configuration.
Recommended Solutions
- Update Trust Relationship Policy
Ensure your trust policy includes both regional and general service endpoints:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "amplify.ap-northeast-1.amazonaws.com", "amplify.amazonaws.com", "lambda.amazonaws.com" ] }, "Action": "sts:AssumeRole" } ] }
- Check IAM Permissions
Ensure the IAM user or role deploying the Amplify app has the iam:PassRole permission to pass roles to both Amplify and Lambda services.
- Add Required Policies
Make sure your service role has all necessary permissions:
AdministratorAccess-Amplify(or equivalent)- The DSQL permissions you've already added
- Lambda execution permissions
- Architecture Recommendations
If the issue persists:
- Using API Gateway + Lambda is a valid alternative architecture that gives you more control over IAM roles
- Amplify Gen 2 with CDK would provide more fine-grained control over resource creation and permissions
- Temporary Workaround
If you need a quick solution while investigating further, you could create a separate Lambda function with the correct permissions and have your SSR application call this Lambda to interact with Aurora DSQL.
Additional Troubleshooting Steps
- Check CloudTrail logs for any denied
AssumeRoleactions - Verify all AWS resources are in the same region (ap-northeast-1)
- Review any inline policies that might be restricting access
- Try invalidating the cache or deploying a fresh version of the app
The most likely issue is related to the IAM role trust relationship and permissions needed for Amplify to pass the role to Lambda for SSR execution.
Sources
Troubleshooting Amazon Aurora DSQL identity and access - Amazon Aurora DSQL
Amplify Error - Unable to assume IAM Role | AWS re:Post
on amplify react app deploy issue | AWS re:Post
answered 10 months ago
Relevant content
asked 5 years ago
asked 2 years ago

Thank you so much! The Compute Role was exactly what I needed. After setting up the Compute Role with DSQL permissions, everything works perfectly now!