-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
support IAM role credentials for Events API subscription #14211
Comments
After a lot of trial and error, I managed to get +import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
...
Amplify.configure(
{
API: {
Events: {
endpoint: '...',
region: '...',
defaultAuthMode: 'iam',
},
},
},
+ {
+ Auth: {
+ credentialsProvider: {
+ getCredentialsAndIdentityId: async () => {
+ const provider = fromNodeProviderChain();
+ const credentials = await provider();
+ return {
+ credentials,
+ };
+ },
+ clearCredentialsAndIdentityId: async () => {},
+ },
+ },
+ },
); |
@tmokmss Have you tried the workaround/solution provided by @eliasbrange? I have labeled this a feature request for the team to consider. |
@chrisbonifacio @eliasbrange Thanks I tried it now and it works! I would like to see this workaround clearly documented somewhere. Also aren't you missed to label the issue? it is still showed as pending-triage (just in case:)). |
By the way, for anyone who wants to use AppSync Events without Amplify libraries, the integ test code in CDK below helped a lot. You need to handle sigv4 by youself to authenticate with iam. |
Is this related to a new or existing framework?
No response
Is this related to a new or existing API?
GraphQL API
Is this related to another service?
AppSync Events
Describe the feature you'd like to request
When I try to use AppSync Events client in Node.js, I cannot use IAM role credentials due to the below error:
code to reproduce:
Describe the solution you'd like
I guess Amplify libraries mainly targets at browser environment, so IAM role support is omitted. However, because Amplify libraries is currently the only easy way to interact with AppSync Events, it'd be great if it supported Node.js environment and IAM role authentication as well.
Describe alternatives you've considered
We can use
defaultAuthMode: 'apiKey'
without problem in Node.js environment. I'm using it as a workaround, but ideally we want to use temporary credentials such as IAM role for security.We can also use role credentials via Cognito identity pool, but it is clearly not ideal with additional cost and resources to manage.
Additional context
No response
Is this something that you'd be interested in working on?
The text was updated successfully, but these errors were encountered: