Obtain permissions to create Amazon Cognito user pool authorizers for a REST API
To create an authorizer with an Amazon Cognito user pool, you must have Allow
permissions to create or update an authorizer with the chosen Amazon Cognito user pool. The
following IAM policy document shows an example of such permissions:
Make sure that the policy is attached to an IAM group that you belong to or an IAM role that you're assigned to.
In the preceding policy document, the apigateway:POST action is for
creating a new authorizer, and the apigateway:PATCH action is for updating
an existing authorizer. You can restrict the policy to a specific region or a particular
API by overriding the first two wildcard (*) characters of the Resource
values, respectively.
The Condition clauses that are used here are to restrict the
Allowed permissions to the specified user pools. When a
Condition clause is present, access to any user pools that don't match
the conditions is denied. When a permission doesn't have a Condition
clause, access to any user pool is allowed.
You have the following options to set the Condition clause:
-
You can set an
ArnLikeorArnEqualsconditional expression to permit creating or updatingCOGNITO_USER_POOLSauthorizers with the specified user pools only. -
You can set an
ArnNotLikeorArnNotEqualsconditional expression to permit creating or updatingCOGNITO_USER_POOLSauthorizers with any user pool that isn't specified in the expression. -
You can omit the
Conditionclause to permit creating or updatingCOGNITO_USER_POOLSauthorizers with any user pool, of any AWS account, and in any region.
For more information on the Amazon Resource Name (ARN) conditional expressions, see
Amazon Resource Name Condition Operators. As shown in the example,
apigateway:CognitoUserPoolProviderArn is a list of ARNs of the
COGNITO_USER_POOLS user pools that can or can't be used with an API Gateway
authorizer of the COGNITO_USER_POOLS type.