amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

How to update AWS::AppSync::GraphQLApi authorization type to AWS_IAM?

Open phanviet opened this issue 7 years ago • 7 comments

** Which Category is your question related to? ** api

** What AWS Services are you utilizing? ** AWS AppSync

** Provide additional details e.g. code snippets ** I try to edit the cloudformation-template.json as below:

        "GraphQLAPI": {
            "Type": "AWS::AppSync::GraphQLApi",
            "Properties": {
                "Name": {
                    "Ref": "AppSyncApiName"
                },
                "AuthenticationType": "AWS_IAM"
            }
        },

And run amplify push. But the gql-compile transform always generate a new cloudformation template with API_KEY (or AMAZON_COGNITOR_USER_POOLS) as previous CLI configuration. So how to update AWS::AppSync::GraphQLApi authorization type to AWS_IAM?

phanviet avatar Dec 24 '18 09:12 phanviet

@phanviet The Amplify CLI currently only supports API Key and Cognito security types. But we have in our roadmap to support IAM as well.

kaustavghosh06 avatar Dec 26 '18 17:12 kaustavghosh06

@kaustavghosh06 Thanks for inform.

phanviet avatar Dec 27 '18 03:12 phanviet

Hi Has this changed with the recent api custom stacks/resolvers update ? or is it still under development ? Regards

jpbourgeon avatar Mar 05 '19 12:03 jpbourgeon

@jpbourgeon We have put out an RFC and it still is not implemented

yuth avatar Mar 15 '19 20:03 yuth

@phanviet I find a turn around to enable AWS_IAM for AppSync, that works for me now. You can add these two cloudformation stacks to your API stack: https://gist.github.com/eelzinaty/f2e6eaf3f8282f3d66db1a0732e5c6dd https://gist.github.com/eelzinaty/8d013575a02245aafacaf926226a870d

Then make sure that your API parameters.json has this:

.....
.....
.....
"authRoleName": "Name of your Amplify Auth Role"

Then, you run amplify push api.

Finally, you change your appsync security in aws_export.json to AWS_IAM.

....
....
....
"aws_appsync_authenticationType": "AWS_IAM"
};

eelzinaty avatar Apr 25 '19 15:04 eelzinaty

We launched multi-auth support for AppSync API (which included public APIs - with API Keys + IAM) as a part of our CLI version 3.8+. Please take a look at our documentation around it out here for more info - https://aws-amplify.github.io/docs/cli-toolchain/graphql#public-authorization

kaustavghosh06 avatar Sep 19 '19 03:09 kaustavghosh06

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

github-actions[bot] avatar May 27 '21 01:05 github-actions[bot]