-
Notifications
You must be signed in to change notification settings - Fork 79
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
Lambda function generated execution role IAM understanding #1298
Comments
Hey @unknown1337 👋 thanks for raising this!
Yes, granting your Lambda access to your GraphQL API through the
Correct, yes, IAM will need to be selected as an auth mechanism
I do not believe IAM is authorized in
Although the shorthand auth rule syntax can be a bit confusing, the
This can even be scoped down to ensure private IAM calls will only be able to "read" records
Were the resources pushed prior to running |
WOW, thanks for the response. Gained some great insights already :)
b) if I sign my request (this I assume is an IAM request as the default provider will provide temporary IAM auth credentials?) And do I need to add a @Auth directive with IAM to the corresponding model?
Thanks, I will try to see if I can find this in the cloudformation code
Yes, thanks, but it was already pushed. I managed to get it working :) by adding {
"adminRoleNames": ["amplify-CR"]
}
Thanks :) |
@josefaidt , could you maybe help me a bit further, I REALLY value your feedback. Thanks! |
Hey 👋 apologies for the delay!
Correct, you can inspect the generated IAM policy in the Function's CloudFormation template, however it will not be created until you push.
If you want to interact with the GraphQL API in that function. For instance, if you have a PostConfirmation Cognito Trigger that creates a
Private IAM will call using the role's credentials, where calling via Cognito User Pool (from a Lambda) will require you to pass the user's JWT. In the case of a PostConfirmation trigger you can call the GraphQL API on the user's behalf by constructing and passing their ID token -- if you are using |
Thanks a lot @josefaidt , most of it is clear!
Where will the token be verified (if e.g. the claims were not altered by the user? I think answer 2a and b are correct?)
b) or needs to call the graphql api as that api will perform the authorization (correct alternative?) Thanks! |
Hey @unknown1337 apologies for the delay!
In the
Yes, calls directly to your GraphQL API will perform the authorization, and enables streaming the mutations in the event you have subscriptions running. If you are looking to insert data directly to the underlying |
Thanks, so does this imply that the tokens passed to a lambda function are 'never' checked for validity. This implies that I
correct? |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Amplify CLI Version
10.7.2
Question
Goal: enable a lambda function to mutation a graphql schema
Company
Method 1, NOK:
Result NOK: "Not Authorized to access listCompanies on type Model"
Method 2, OK, but not understood & documentation mismatch?
Result OK: 'list of companies'
Questions
{ provider: iam, allow: private }
in the @auth gql scheme? According my tests, yes, but this is contradicting the documentation "...these functions have special access privileges that are scoped based on their IAM policy instead of any particular @auth rule."amplify add api
IAM needs to be selected as Auth mechanism?amplify init
is 'used'? Thus I have to add the correct policies to that IAM user to allow GQL permissions? For now I addedadministrator access
(not really the least priviledge WoW).company
due to{ provider: iam, allow: private }
(private = any signed-in user has access.) IFF possible some context (or suggested reading material) would help me understand and learn.amplify mock function
:Not Authorized to access listCompanies on type ModelCompanyConnection
. I have no clue what could be wrong as the model contains { provider: iam, allow: private } & my local IAM user (local-aws-info.json) has theAdministratorAccess
policy assigned. Any tips?THANKS A LOT!
The text was updated successfully, but these errors were encountered: