Skip to main content

usage_plans

Creates, updates, deletes or gets an usage_plan resource or lists usage_plans in a region

Overview

Nameusage_plans
TypeResource
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 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 to monitor costs and to manage API requests.
Idawscc.apigateway.usage_plans

Fields

NameDatatypeDescription
idstring
api_stagesarray
descriptionstring
quotaobject
QuotaSettings is a property of the AWS::ApiGateway::UsagePlan resource that specifies a target for the maximum number of requests users can make to your REST APIs.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.
tagsarray
throttleobjectThrottleSettings is a property of the AWS::ApiGateway::UsagePlan resource that specifies the overall request rate (average requests per second) and burst capacity when users call your REST APIs.
usage_plan_namestring
regionstringAWS region.

For more information, see AWS::ApiGateway::UsagePlan.

Methods

NameResourceAccessible byRequired Params
create_resourceusage_plansINSERTregion
delete_resourceusage_plansDELETEIdentifier, region
update_resourceusage_plansUPDATEIdentifier, PatchDocument, region
list_resourcesusage_plans_list_onlySELECTregion
get_resourceusage_plansSELECTIdentifier, region

SELECT examples

Gets all properties from an individual usage_plan.

SELECT
region,
id,
api_stages,
description,
quota,
tags,
throttle,
usage_plan_name
FROM awscc.apigateway.usage_plans
WHERE
region = '{{ region }}' AND
Identifier = '{{ id }}';

INSERT example

Use the following StackQL query and manifest file to create a new usage_plan resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.apigateway.usage_plans (
ApiStages,
Description,
Quota,
Tags,
Throttle,
UsagePlanName,
region
)
SELECT
'{{ api_stages }}',
'{{ description }}',
'{{ quota }}',
'{{ tags }}',
'{{ throttle }}',
'{{ usage_plan_name }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

UPDATE example

Use the following StackQL query and manifest file to update a usage_plan resource, using stack-deploy.

/*+ update */
UPDATE awscc.apigateway.usage_plans
SET PatchDocument = string('{{ {
"ApiStages": api_stages,
"Description": description,
"Quota": quota,
"Tags": tags,
"Throttle": throttle,
"UsagePlanName": usage_plan_name
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ id }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

DELETE example

/*+ delete */
DELETE FROM awscc.apigateway.usage_plans
WHERE
Identifier = '{{ id }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

Additional Parameters

Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:

ParameterDescription
ClientToken
A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.
A client token is valid for 36 hours once used.
After that, a resource request with the same client token is treated as a new request.
If you do not specify a client token, one is generated for inclusion in the request.
RoleArn
The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.
If you do not specify a role, a temporary session is created using your AWS user credentials.
TypeVersionId
For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used.

Permissions

To operate on the usage_plans resource, the following permissions are required:

apigateway:POST,
apigateway:GET,
apigateway:PUT