1. Packages
  2. AWS
  3. API Docs
  4. apigateway
  5. UsagePlan
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.apigateway.UsagePlan

Explore with Pulumi AI

Provides an API Gateway Usage Plan.

Create UsagePlan Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new UsagePlan(name: string, args?: UsagePlanArgs, opts?: CustomResourceOptions);
@overload
def UsagePlan(resource_name: str,
              args: Optional[UsagePlanArgs] = None,
              opts: Optional[ResourceOptions] = None)

@overload
def UsagePlan(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              api_stages: Optional[Sequence[UsagePlanApiStageArgs]] = None,
              description: Optional[str] = None,
              name: Optional[str] = None,
              product_code: Optional[str] = None,
              quota_settings: Optional[UsagePlanQuotaSettingsArgs] = None,
              tags: Optional[Mapping[str, str]] = None,
              throttle_settings: Optional[UsagePlanThrottleSettingsArgs] = None)
func NewUsagePlan(ctx *Context, name string, args *UsagePlanArgs, opts ...ResourceOption) (*UsagePlan, error)
public UsagePlan(string name, UsagePlanArgs? args = null, CustomResourceOptions? opts = null)
public UsagePlan(String name, UsagePlanArgs args)
public UsagePlan(String name, UsagePlanArgs args, CustomResourceOptions options)
type: aws:apigateway:UsagePlan
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args UsagePlanArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args UsagePlanArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args UsagePlanArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args UsagePlanArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. UsagePlanArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var usagePlanResource = new Aws.ApiGateway.UsagePlan("usagePlanResource", new()
{
    ApiStages = new[]
    {
        new Aws.ApiGateway.Inputs.UsagePlanApiStageArgs
        {
            ApiId = "string",
            Stage = "string",
            Throttles = new[]
            {
                new Aws.ApiGateway.Inputs.UsagePlanApiStageThrottleArgs
                {
                    Path = "string",
                    BurstLimit = 0,
                    RateLimit = 0,
                },
            },
        },
    },
    Description = "string",
    Name = "string",
    ProductCode = "string",
    QuotaSettings = new Aws.ApiGateway.Inputs.UsagePlanQuotaSettingsArgs
    {
        Limit = 0,
        Period = "string",
        Offset = 0,
    },
    Tags = 
    {
        { "string", "string" },
    },
    ThrottleSettings = new Aws.ApiGateway.Inputs.UsagePlanThrottleSettingsArgs
    {
        BurstLimit = 0,
        RateLimit = 0,
    },
});
Copy
example, err := apigateway.NewUsagePlan(ctx, "usagePlanResource", &apigateway.UsagePlanArgs{
	ApiStages: apigateway.UsagePlanApiStageArray{
		&apigateway.UsagePlanApiStageArgs{
			ApiId: pulumi.String("string"),
			Stage: pulumi.String("string"),
			Throttles: apigateway.UsagePlanApiStageThrottleArray{
				&apigateway.UsagePlanApiStageThrottleArgs{
					Path:       pulumi.String("string"),
					BurstLimit: pulumi.Int(0),
					RateLimit:  pulumi.Float64(0),
				},
			},
		},
	},
	Description: pulumi.String("string"),
	Name:        pulumi.String("string"),
	ProductCode: pulumi.String("string"),
	QuotaSettings: &apigateway.UsagePlanQuotaSettingsArgs{
		Limit:  pulumi.Int(0),
		Period: pulumi.String("string"),
		Offset: pulumi.Int(0),
	},
	Tags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	ThrottleSettings: &apigateway.UsagePlanThrottleSettingsArgs{
		BurstLimit: pulumi.Int(0),
		RateLimit:  pulumi.Float64(0),
	},
})
Copy
var usagePlanResource = new UsagePlan("usagePlanResource", UsagePlanArgs.builder()
    .apiStages(UsagePlanApiStageArgs.builder()
        .apiId("string")
        .stage("string")
        .throttles(UsagePlanApiStageThrottleArgs.builder()
            .path("string")
            .burstLimit(0)
            .rateLimit(0)
            .build())
        .build())
    .description("string")
    .name("string")
    .productCode("string")
    .quotaSettings(UsagePlanQuotaSettingsArgs.builder()
        .limit(0)
        .period("string")
        .offset(0)
        .build())
    .tags(Map.of("string", "string"))
    .throttleSettings(UsagePlanThrottleSettingsArgs.builder()
        .burstLimit(0)
        .rateLimit(0)
        .build())
    .build());
Copy
usage_plan_resource = aws.apigateway.UsagePlan("usagePlanResource",
    api_stages=[{
        "api_id": "string",
        "stage": "string",
        "throttles": [{
            "path": "string",
            "burst_limit": 0,
            "rate_limit": 0,
        }],
    }],
    description="string",
    name="string",
    product_code="string",
    quota_settings={
        "limit": 0,
        "period": "string",
        "offset": 0,
    },
    tags={
        "string": "string",
    },
    throttle_settings={
        "burst_limit": 0,
        "rate_limit": 0,
    })
Copy
const usagePlanResource = new aws.apigateway.UsagePlan("usagePlanResource", {
    apiStages: [{
        apiId: "string",
        stage: "string",
        throttles: [{
            path: "string",
            burstLimit: 0,
            rateLimit: 0,
        }],
    }],
    description: "string",
    name: "string",
    productCode: "string",
    quotaSettings: {
        limit: 0,
        period: "string",
        offset: 0,
    },
    tags: {
        string: "string",
    },
    throttleSettings: {
        burstLimit: 0,
        rateLimit: 0,
    },
});
Copy
type: aws:apigateway:UsagePlan
properties:
    apiStages:
        - apiId: string
          stage: string
          throttles:
            - burstLimit: 0
              path: string
              rateLimit: 0
    description: string
    name: string
    productCode: string
    quotaSettings:
        limit: 0
        offset: 0
        period: string
    tags:
        string: string
    throttleSettings:
        burstLimit: 0
        rateLimit: 0
Copy

UsagePlan Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The UsagePlan resource accepts the following input properties:

ApiStages List<UsagePlanApiStage>
Associated API stages of the usage plan.
Description string
Description of a usage plan.
Name string
Name of the usage plan.
ProductCode string
AWS Marketplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
QuotaSettings UsagePlanQuotaSettings
Quota of the usage plan.
Tags Dictionary<string, string>
ThrottleSettings UsagePlanThrottleSettings
Throttling limits of the usage plan.
ApiStages []UsagePlanApiStageArgs
Associated API stages of the usage plan.
Description string
Description of a usage plan.
Name string
Name of the usage plan.
ProductCode string
AWS Marketplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
QuotaSettings UsagePlanQuotaSettingsArgs
Quota of the usage plan.
Tags map[string]string
ThrottleSettings UsagePlanThrottleSettingsArgs
Throttling limits of the usage plan.
apiStages List<UsagePlanApiStage>
Associated API stages of the usage plan.
description String
Description of a usage plan.
name String
Name of the usage plan.
productCode String
AWS Marketplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
quotaSettings UsagePlanQuotaSettings
Quota of the usage plan.
tags Map<String,String>
throttleSettings UsagePlanThrottleSettings
Throttling limits of the usage plan.
apiStages UsagePlanApiStage[]
Associated API stages of the usage plan.
description string
Description of a usage plan.
name string
Name of the usage plan.
productCode string
AWS Marketplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
quotaSettings UsagePlanQuotaSettings
Quota of the usage plan.
tags {[key: string]: string}
throttleSettings UsagePlanThrottleSettings
Throttling limits of the usage plan.
api_stages Sequence[UsagePlanApiStageArgs]
Associated API stages of the usage plan.
description str
Description of a usage plan.
name str
Name of the usage plan.
product_code str
AWS Marketplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
quota_settings UsagePlanQuotaSettingsArgs
Quota of the usage plan.
tags Mapping[str, str]
throttle_settings UsagePlanThrottleSettingsArgs
Throttling limits of the usage plan.
apiStages List<Property Map>
Associated API stages of the usage plan.
description String
Description of a usage plan.
name String
Name of the usage plan.
productCode String
AWS Marketplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
quotaSettings Property Map
Quota of the usage plan.
tags Map<String>
throttleSettings Property Map
Throttling limits of the usage plan.

Outputs

All input properties are implicitly available as output properties. Additionally, the UsagePlan resource produces the following output properties:

Arn string
ARN
Id string
The provider-assigned unique ID for this managed resource.
TagsAll Dictionary<string, string>
Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Arn string
ARN
Id string
The provider-assigned unique ID for this managed resource.
TagsAll map[string]string
Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
ARN
id String
The provider-assigned unique ID for this managed resource.
tagsAll Map<String,String>
Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn string
ARN
id string
The provider-assigned unique ID for this managed resource.
tagsAll {[key: string]: string}
Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn str
ARN
id str
The provider-assigned unique ID for this managed resource.
tags_all Mapping[str, str]
Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
ARN
id String
The provider-assigned unique ID for this managed resource.
tagsAll Map<String>
Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Look up Existing UsagePlan Resource

Get an existing UsagePlan resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: UsagePlanState, opts?: CustomResourceOptions): UsagePlan
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        api_stages: Optional[Sequence[UsagePlanApiStageArgs]] = None,
        arn: Optional[str] = None,
        description: Optional[str] = None,
        name: Optional[str] = None,
        product_code: Optional[str] = None,
        quota_settings: Optional[UsagePlanQuotaSettingsArgs] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None,
        throttle_settings: Optional[UsagePlanThrottleSettingsArgs] = None) -> UsagePlan
func GetUsagePlan(ctx *Context, name string, id IDInput, state *UsagePlanState, opts ...ResourceOption) (*UsagePlan, error)
public static UsagePlan Get(string name, Input<string> id, UsagePlanState? state, CustomResourceOptions? opts = null)
public static UsagePlan get(String name, Output<String> id, UsagePlanState state, CustomResourceOptions options)
resources:  _:    type: aws:apigateway:UsagePlan    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
ApiStages List<UsagePlanApiStage>
Associated API stages of the usage plan.
Arn string
ARN
Description string
Description of a usage plan.
Name string
Name of the usage plan.
ProductCode string
AWS Marketplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
QuotaSettings UsagePlanQuotaSettings
Quota of the usage plan.
Tags Dictionary<string, string>
TagsAll Dictionary<string, string>
Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

ThrottleSettings UsagePlanThrottleSettings
Throttling limits of the usage plan.
ApiStages []UsagePlanApiStageArgs
Associated API stages of the usage plan.
Arn string
ARN
Description string
Description of a usage plan.
Name string
Name of the usage plan.
ProductCode string
AWS Marketplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
QuotaSettings UsagePlanQuotaSettingsArgs
Quota of the usage plan.
Tags map[string]string
TagsAll map[string]string
Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

ThrottleSettings UsagePlanThrottleSettingsArgs
Throttling limits of the usage plan.
apiStages List<UsagePlanApiStage>
Associated API stages of the usage plan.
arn String
ARN
description String
Description of a usage plan.
name String
Name of the usage plan.
productCode String
AWS Marketplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
quotaSettings UsagePlanQuotaSettings
Quota of the usage plan.
tags Map<String,String>
tagsAll Map<String,String>
Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

throttleSettings UsagePlanThrottleSettings
Throttling limits of the usage plan.
apiStages UsagePlanApiStage[]
Associated API stages of the usage plan.
arn string
ARN
description string
Description of a usage plan.
name string
Name of the usage plan.
productCode string
AWS Marketplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
quotaSettings UsagePlanQuotaSettings
Quota of the usage plan.
tags {[key: string]: string}
tagsAll {[key: string]: string}
Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

throttleSettings UsagePlanThrottleSettings
Throttling limits of the usage plan.
api_stages Sequence[UsagePlanApiStageArgs]
Associated API stages of the usage plan.
arn str
ARN
description str
Description of a usage plan.
name str
Name of the usage plan.
product_code str
AWS Marketplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
quota_settings UsagePlanQuotaSettingsArgs
Quota of the usage plan.
tags Mapping[str, str]
tags_all Mapping[str, str]
Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

throttle_settings UsagePlanThrottleSettingsArgs
Throttling limits of the usage plan.
apiStages List<Property Map>
Associated API stages of the usage plan.
arn String
ARN
description String
Description of a usage plan.
name String
Name of the usage plan.
productCode String
AWS Marketplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.
quotaSettings Property Map
Quota of the usage plan.
tags Map<String>
tagsAll Map<String>
Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

throttleSettings Property Map
Throttling limits of the usage plan.

Supporting Types

UsagePlanApiStage
, UsagePlanApiStageArgs

ApiId This property is required. string
API Id of the associated API stage in a usage plan.
Stage This property is required. string
API stage name of the associated API stage in a usage plan.
Throttles List<UsagePlanApiStageThrottle>
The throttling limits of the usage plan.
ApiId This property is required. string
API Id of the associated API stage in a usage plan.
Stage This property is required. string
API stage name of the associated API stage in a usage plan.
Throttles []UsagePlanApiStageThrottle
The throttling limits of the usage plan.
apiId This property is required. String
API Id of the associated API stage in a usage plan.
stage This property is required. String
API stage name of the associated API stage in a usage plan.
throttles List<UsagePlanApiStageThrottle>
The throttling limits of the usage plan.
apiId This property is required. string
API Id of the associated API stage in a usage plan.
stage This property is required. string
API stage name of the associated API stage in a usage plan.
throttles UsagePlanApiStageThrottle[]
The throttling limits of the usage plan.
api_id This property is required. str
API Id of the associated API stage in a usage plan.
stage This property is required. str
API stage name of the associated API stage in a usage plan.
throttles Sequence[UsagePlanApiStageThrottle]
The throttling limits of the usage plan.
apiId This property is required. String
API Id of the associated API stage in a usage plan.
stage This property is required. String
API stage name of the associated API stage in a usage plan.
throttles List<Property Map>
The throttling limits of the usage plan.

UsagePlanApiStageThrottle
, UsagePlanApiStageThrottleArgs

Path This property is required. string
Method to apply the throttle settings for. Specfiy the path and method, for example /test/GET.
BurstLimit int
The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.
RateLimit double
The API request steady-state rate limit.
Path This property is required. string
Method to apply the throttle settings for. Specfiy the path and method, for example /test/GET.
BurstLimit int
The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.
RateLimit float64
The API request steady-state rate limit.
path This property is required. String
Method to apply the throttle settings for. Specfiy the path and method, for example /test/GET.
burstLimit Integer
The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.
rateLimit Double
The API request steady-state rate limit.
path This property is required. string
Method to apply the throttle settings for. Specfiy the path and method, for example /test/GET.
burstLimit number
The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.
rateLimit number
The API request steady-state rate limit.
path This property is required. str
Method to apply the throttle settings for. Specfiy the path and method, for example /test/GET.
burst_limit int
The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.
rate_limit float
The API request steady-state rate limit.
path This property is required. String
Method to apply the throttle settings for. Specfiy the path and method, for example /test/GET.
burstLimit Number
The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.
rateLimit Number
The API request steady-state rate limit.

UsagePlanQuotaSettings
, UsagePlanQuotaSettingsArgs

Limit This property is required. int
Maximum number of requests that can be made in a given time period.
Period This property is required. string
Time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH".
Offset int
Number of requests subtracted from the given limit in the initial time period.
Limit This property is required. int
Maximum number of requests that can be made in a given time period.
Period This property is required. string
Time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH".
Offset int
Number of requests subtracted from the given limit in the initial time period.
limit This property is required. Integer
Maximum number of requests that can be made in a given time period.
period This property is required. String
Time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH".
offset Integer
Number of requests subtracted from the given limit in the initial time period.
limit This property is required. number
Maximum number of requests that can be made in a given time period.
period This property is required. string
Time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH".
offset number
Number of requests subtracted from the given limit in the initial time period.
limit This property is required. int
Maximum number of requests that can be made in a given time period.
period This property is required. str
Time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH".
offset int
Number of requests subtracted from the given limit in the initial time period.
limit This property is required. Number
Maximum number of requests that can be made in a given time period.
period This property is required. String
Time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH".
offset Number
Number of requests subtracted from the given limit in the initial time period.

UsagePlanThrottleSettings
, UsagePlanThrottleSettingsArgs

burstLimit Integer
rateLimit Double
burstLimit number
rateLimit number
burstLimit Number
rateLimit Number

Import

Using pulumi import, import AWS API Gateway Usage Plan using the id. For example:

$ pulumi import aws:apigateway/usagePlan:UsagePlan myusageplan <usage_plan_id>
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.