usage_plans
Creates, updates, deletes or gets an usage_plan
resource or lists usage_plans
in a region
Overview
Name | usage_plans |
Type | Resource |
Description | The AWS::ApiGateway::UsagePlan resource creates a usage plan for deployed APIs. A usage plan sets a target for the throttling and quota limits on individual client API keys. For more information, see [Creating and Using API Usage Plans in Amazon API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-api-usage-plans.html) in the *API Gateway Developer Guide*.In some cases clients can exceed the targets that you set. Don’t rely on usage plans to control costs. Consider using [](https://docs.aws.amazon.com/cost-management/latest/userguide/budgets-managing-costs.html) to monitor costs and [](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html) to manage API requests. |
Id | aws.apigateway.usage_plans |
Fields
Name | Datatype | Description |
---|---|---|
id | string | |
api_stages | array | The associated API stages of a usage plan. |
description | string | The description of a usage plan. |
quota | object | The target maximum number of permitted requests per a given unit time interval. |
tags | array | The collection of tags. Each tag element is associated with a given resource. |
throttle | object | A map containing method level throttling information for API stage in a usage plan. |
usage_plan_name | string | The name of a usage plan. |
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 usage_plans
in a region.
SELECT
region,
id,
api_stages,
description,
quota,
tags,
throttle,
usage_plan_name
FROM aws.apigateway.usage_plans
WHERE region = 'us-east-1';
Gets all properties from an individual usage_plan
.
SELECT
region,
id,
api_stages,
description,
quota,
tags,
throttle,
usage_plan_name
FROM aws.apigateway.usage_plans
WHERE region = 'us-east-1' AND data__Identifier = '<Id>';
INSERT
example
Use the following StackQL query and manifest file to create a new usage_plan
resource, using stack-deploy
.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO aws.apigateway.usage_plans (
ApiStages,
Description,
Quota,
Tags,
Throttle,
UsagePlanName,
region
)
SELECT
'{{ ApiStages }}',
'{{ Description }}',
'{{ Quota }}',
'{{ Tags }}',
'{{ Throttle }}',
'{{ UsagePlanName }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.apigateway.usage_plans (
ApiStages,
Description,
Quota,
Tags,
Throttle,
UsagePlanName,
region
)
SELECT
'{{ ApiStages }}',
'{{ Description }}',
'{{ Quota }}',
'{{ Tags }}',
'{{ Throttle }}',
'{{ UsagePlanName }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: usage_plan
props:
- name: ApiStages
value:
- ApiId: '{{ ApiId }}'
Stage: '{{ Stage }}'
Throttle: {}
- name: Description
value: '{{ Description }}'
- name: Quota
value:
Limit: '{{ Limit }}'
Offset: '{{ Offset }}'
Period: '{{ Period }}'
- name: Tags
value:
- Value: '{{ Value }}'
Key: '{{ Key }}'
- name: Throttle
value:
BurstLimit: '{{ BurstLimit }}'
RateLimit: null
- name: UsagePlanName
value: '{{ UsagePlanName }}'
DELETE
example
/*+ delete */
DELETE FROM aws.apigateway.usage_plans
WHERE data__Identifier = '<Id>'
AND region = 'us-east-1';
Permissions
To operate on the usage_plans
resource, the following permissions are required:
Create
apigateway:POST,
apigateway:GET,
apigateway:PUT
Read
apigateway:GET
Update
apigateway:GET,
apigateway:DELETE,
apigateway:PATCH,
apigateway:PUT
Delete
apigateway:DELETE,
apigateway:GET,
apigateway:PATCH
List
apigateway:GET