AWS API Gateway Usage Plan Key

This page shows how to write Terraform and CloudFormation for API Gateway Usage Plan Key and write them securely.

aws_api_gateway_usage_plan_key (Terraform)

The Usage Plan Key in API Gateway can be configured in Terraform with the resource name aws_api_gateway_usage_plan_key. The following sections describe 2 examples of how to use the resource and its parameters.

Example Usage from GitHub

resource "aws_api_gateway_usage_plan_key" "dummy" {
  # Only deploy the dummy client if it's a non-production environment...
  count = lower(terraform.workspace) != "prod" ? 1 : 0

  key_id        = aws_api_gateway_api_key.dummy[0].id
  usage_plan_id =
resource "aws_api_gateway_usage_plan_key" "main" {
  key_id        =
  key_type      = "API_KEY"
  usage_plan_id =


Explanation in Terraform Registry

Provides an API Gateway Usage Plan Key.

AWS::ApiGateway::UsagePlanKey (CloudFormation)

The UsagePlanKey in ApiGateway can be configured in CloudFormation with the resource name AWS::ApiGateway::UsagePlanKey. The following sections describe how to use the resource and its parameters.


Explanation in CloudFormation Registry

The AWS::ApiGateway::UsagePlanKey resource associates an API key with a usage plan. This association determines which users the usage plan is applied to.

Frequently asked questions

What is AWS API Gateway Usage Plan Key?

AWS API Gateway Usage Plan Key is a resource for API Gateway of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS API Gateway Usage Plan Key?

For Terraform, the wellcomecollection/identity and vgulkevic/Assets-Wallet source code examples are useful. See the Terraform Example section for further details.