api_keys
Creates, updates, deletes or gets an api_key
resource or lists api_keys
in a region
Overview
Name | api_keys |
Type | Resource |
Description | The AWS::ApiGateway::ApiKey resource creates a unique key that you can distribute to clients who are executing API Gateway Method resources that require an API key. To specify which API key clients must use, map the API key with the RestApi and Stage resources that include the methods that require a key. |
Id | aws.apigateway.api_keys |
Fields
Name | Datatype | Description |
---|---|---|
api_key_id | string | |
customer_id | string | An MKT customer identifier, when integrating with the AWS SaaS Marketplace. |
description | string | The description of the ApiKey. |
enabled | boolean | Specifies whether the ApiKey can be used by callers. |
generate_distinct_id | boolean | Specifies whether (true ) or not (false ) the key identifier is distinct from the created API key value. This parameter is deprecated and should not be used. |
name | string | A name for the API key. If you don't specify a name, CFN generates a unique physical ID and uses that ID for the API key name. For more information, see [Name Type](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-name.html). If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name. |
stage_keys | array | DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key. |
tags | array | The key-value map of strings. The valid character set is [a-zA-Z+-=._:/]. The tag key can be up to 128 characters and must not start with aws: . The tag value can be up to 256 characters. |
value | string | Specifies a value of the API key. |
region | string | AWS region. |
Methods
Name | Accessible by | Required Params |
---|---|---|
create_resource | INSERT | region |
delete_resource | DELETE | data__Identifier, region |
update_resource | UPDATE | data__Identifier, data__PatchDocument, region |
list_resources | SELECT | region |
get_resource | SELECT | data__Identifier, region |
SELECT
examples
Gets all api_keys
in a region.
SELECT
region,
api_key_id,
customer_id,
description,
enabled,
generate_distinct_id,
name,
stage_keys,
tags,
value
FROM aws.apigateway.api_keys
WHERE region = 'us-east-1';
Gets all properties from an individual api_key
.
SELECT
region,
api_key_id,
customer_id,
description,
enabled,
generate_distinct_id,
name,
stage_keys,
tags,
value
FROM aws.apigateway.api_keys
WHERE region = 'us-east-1' AND data__Identifier = '<APIKeyId>';
INSERT
example
Use the following StackQL query and manifest file to create a new api_key
resource, using stack-deploy
.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO aws.apigateway.api_keys (
CustomerId,
Description,
Enabled,
GenerateDistinctId,
Name,
StageKeys,
Tags,
Value,
region
)
SELECT
'{{ CustomerId }}',
'{{ Description }}',
'{{ Enabled }}',
'{{ GenerateDistinctId }}',
'{{ Name }}',
'{{ StageKeys }}',
'{{ Tags }}',
'{{ Value }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.apigateway.api_keys (
CustomerId,
Description,
Enabled,
GenerateDistinctId,
Name,
StageKeys,
Tags,
Value,
region
)
SELECT
'{{ CustomerId }}',
'{{ Description }}',
'{{ Enabled }}',
'{{ GenerateDistinctId }}',
'{{ Name }}',
'{{ StageKeys }}',
'{{ Tags }}',
'{{ Value }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: api_key
props:
- name: CustomerId
value: '{{ CustomerId }}'
- name: Description
value: '{{ Description }}'
- name: Enabled
value: '{{ Enabled }}'
- name: GenerateDistinctId
value: '{{ GenerateDistinctId }}'
- name: Name
value: '{{ Name }}'
- name: StageKeys
value:
- RestApiId: '{{ RestApiId }}'
StageName: '{{ StageName }}'
- name: Tags
value:
- Value: '{{ Value }}'
Key: '{{ Key }}'
- name: Value
value: '{{ Value }}'
DELETE
example
/*+ delete */
DELETE FROM aws.apigateway.api_keys
WHERE data__Identifier = '<APIKeyId>'
AND region = 'us-east-1';
Permissions
To operate on the api_keys
resource, the following permissions are required:
Create
apigateway:POST,
apigateway:GET,
apigateway:PUT
Read
apigateway:GET
Update
apigateway:GET,
apigateway:PATCH,
apigateway:PUT,
apigateway:DELETE
Delete
apigateway:DELETE,
apigateway:GET
List
apigateway:GET