Skip to main content

resource_servers

Creates, updates, deletes, gets or lists a resource_servers resource.

Overview

Nameresource_servers
TypeResource
Idaws.cognito_idp.resource_servers

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
identifierstringA unique resource server identifier for the resource server. The identifier can be an API friendly name like solar-system-data. You can also set an API URL like https:​//solar-system-data-api.example.com as your identifier. Amazon Cognito represents scopes in the access token in the format $resource-server-identifier/$scope. Longer scope-identifier strings increase the size of your access tokens. (pattern: <code>[\x21\x23-\x5B\x5D-\x7E]+</code>)
namestringThe name of the resource server. (pattern: <code>[\w\s+=,.@-]+</code>)
scopesarrayA list of scopes that are defined for the resource server.
user_pool_idstringThe ID of the user pool that contains the resource server configuration. (pattern: <code>[\w-]+_[0-9a-zA-Z]+</code>)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_resource_serverselectregionDescribes a resource server. For more information about resource servers, see Access control with resource servers.
create_resource_serverinsertregion, UserPoolIdCreates a new OAuth2.0 resource server and defines custom scopes within it. Resource servers are associated with custom scopes and machine-to-machine (M2M) authorization. For more information, see Access control with resource servers. Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy. Learn more Signing Amazon Web Services API Requests Using the Amazon Cognito user pools API and user pool endpoints
update_resource_serverupdateregion, UserPoolIdUpdates the name and scopes of a resource server. All other fields are read-only. For more information about resource servers, see Access control with resource servers. If you don't provide a value for an attribute, it is set to the default value. Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy. Learn more Signing Amazon Web Services API Requests Using the Amazon Cognito user pools API and user pool endpoints
delete_resource_serverdeleteregionDeletes a resource server. After you delete a resource server, users can no longer generate access tokens with scopes that are associate with that resource server. Resource servers are associated with custom scopes and machine-to-machine (M2M) authorization. For more information, see Access control with resource servers. Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy. Learn more Signing Amazon Web Services API Requests Using the Amazon Cognito user pools API and user pool endpoints
list_resource_serversexecregion, UserPoolIdGiven a user pool ID, returns all resource servers and their details. For more information about resource servers, see Access control with resource servers. Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy. Learn more Signing Amazon Web Services API Requests Using the Amazon Cognito user pools API and user pool endpoints

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Describes a resource server. For more information about resource servers, see Access control with resource servers.

SELECT
identifier,
name,
scopes,
user_pool_id
FROM aws.cognito_idp.resource_servers
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a new OAuth2.0 resource server and defines custom scopes within it. Resource servers are associated with custom scopes and machine-to-machine (M2M) authorization. For more information, see Access control with resource servers. Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy. Learn more Signing Amazon Web Services API Requests Using the Amazon Cognito user pools API and user pool endpoints

INSERT INTO aws.cognito_idp.resource_servers (
UserPoolId,
Identifier,
Name,
Scopes,
region
)
SELECT
'{{ UserPoolId }}' /* required */,
'{{ Identifier }}',
'{{ Name }}',
'{{ Scopes }}',
'{{ region }}'
RETURNING
resource_server
;

UPDATE examples

Updates the name and scopes of a resource server. All other fields are read-only. For more information about resource servers, see Access control with resource servers. If you don't provide a value for an attribute, it is set to the default value. Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy. Learn more Signing Amazon Web Services API Requests Using the Amazon Cognito user pools API and user pool endpoints

UPDATE aws.cognito_idp.resource_servers
SET
UserPoolId = '{{ UserPoolId }}',
Identifier = '{{ Identifier }}',
Name = '{{ Name }}',
Scopes = '{{ Scopes }}'
WHERE
region = '{{ region }}' --required
AND UserPoolId = '{{ UserPoolId }}' --required
RETURNING
resource_server;

DELETE examples

Deletes a resource server. After you delete a resource server, users can no longer generate access tokens with scopes that are associate with that resource server. Resource servers are associated with custom scopes and machine-to-machine (M2M) authorization. For more information, see Access control with resource servers. Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy. Learn more Signing Amazon Web Services API Requests Using the Amazon Cognito user pools API and user pool endpoints

DELETE FROM aws.cognito_idp.resource_servers
WHERE region = '{{ region }}' --required
;

Lifecycle Methods

Given a user pool ID, returns all resource servers and their details. For more information about resource servers, see Access control with resource servers. Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy. Learn more Signing Amazon Web Services API Requests Using the Amazon Cognito user pools API and user pool endpoints

EXEC aws.cognito_idp.resource_servers.list_resource_servers
@region='{{ region }}' --required
@@json=
'{
"UserPoolId": "{{ UserPoolId }}",
"MaxResults": {{ MaxResults }},
"NextToken": "{{ NextToken }}"
}'
;