We recommend new projects start with resources from the AWS provider.
aws-native.apigateway.ApiKey
Explore with Pulumi AI
We recommend new projects start with resources from the AWS provider.
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.
Example Usage
Example
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var apiKeyName = config.Require("apiKeyName");
var customerId = config.Require("customerId");
var generateDistinctId = config.Require("generateDistinctId");
var apiKey = new AwsNative.ApiGateway.ApiKey("apiKey", new()
{
CustomerId = customerId,
GenerateDistinctId = generateDistinctId,
Name = apiKeyName,
});
});
package main
import (
"github.com/pulumi/pulumi-aws-native/sdk/go/aws/apigateway"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
apiKeyName := cfg.Require("apiKeyName")
customerId := cfg.Require("customerId")
generateDistinctId := cfg.Require("generateDistinctId")
_, err := apigateway.NewApiKey(ctx, "apiKey", &apigateway.ApiKeyArgs{
CustomerId: pulumi.String(customerId),
GenerateDistinctId: pulumi.String(generateDistinctId),
Name: pulumi.String(apiKeyName),
})
if err != nil {
return err
}
return nil
})
}
Coming soon!
import pulumi
import pulumi_aws_native as aws_native
config = pulumi.Config()
api_key_name = config.require("apiKeyName")
customer_id = config.require("customerId")
generate_distinct_id = config.require("generateDistinctId")
api_key = aws_native.apigateway.ApiKey("apiKey",
customer_id=customer_id,
generate_distinct_id=generate_distinct_id,
name=api_key_name)
import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";
const config = new pulumi.Config();
const apiKeyName = config.require("apiKeyName");
const customerId = config.require("customerId");
const generateDistinctId = config.require("generateDistinctId");
const apiKey = new aws_native.apigateway.ApiKey("apiKey", {
customerId: customerId,
generateDistinctId: generateDistinctId,
name: apiKeyName,
});
Coming soon!
Example
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var apiKeyName = config.Require("apiKeyName");
var customerId = config.Require("customerId");
var generateDistinctId = config.Require("generateDistinctId");
var apiKey = new AwsNative.ApiGateway.ApiKey("apiKey", new()
{
CustomerId = customerId,
GenerateDistinctId = generateDistinctId,
Name = apiKeyName,
});
});
package main
import (
"github.com/pulumi/pulumi-aws-native/sdk/go/aws/apigateway"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
apiKeyName := cfg.Require("apiKeyName")
customerId := cfg.Require("customerId")
generateDistinctId := cfg.Require("generateDistinctId")
_, err := apigateway.NewApiKey(ctx, "apiKey", &apigateway.ApiKeyArgs{
CustomerId: pulumi.String(customerId),
GenerateDistinctId: pulumi.String(generateDistinctId),
Name: pulumi.String(apiKeyName),
})
if err != nil {
return err
}
return nil
})
}
Coming soon!
import pulumi
import pulumi_aws_native as aws_native
config = pulumi.Config()
api_key_name = config.require("apiKeyName")
customer_id = config.require("customerId")
generate_distinct_id = config.require("generateDistinctId")
api_key = aws_native.apigateway.ApiKey("apiKey",
customer_id=customer_id,
generate_distinct_id=generate_distinct_id,
name=api_key_name)
import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";
const config = new pulumi.Config();
const apiKeyName = config.require("apiKeyName");
const customerId = config.require("customerId");
const generateDistinctId = config.require("generateDistinctId");
const apiKey = new aws_native.apigateway.ApiKey("apiKey", {
customerId: customerId,
generateDistinctId: generateDistinctId,
name: apiKeyName,
});
Coming soon!
Create ApiKey Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ApiKey(name: string, args?: ApiKeyArgs, opts?: CustomResourceOptions);
@overload
def ApiKey(resource_name: str,
args: Optional[ApiKeyArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def ApiKey(resource_name: str,
opts: Optional[ResourceOptions] = None,
customer_id: Optional[str] = None,
description: Optional[str] = None,
enabled: Optional[bool] = None,
generate_distinct_id: Optional[bool] = None,
name: Optional[str] = None,
stage_keys: Optional[Sequence[ApiKeyStageKeyArgs]] = None,
tags: Optional[Sequence[_root_inputs.TagArgs]] = None,
value: Optional[str] = None)
func NewApiKey(ctx *Context, name string, args *ApiKeyArgs, opts ...ResourceOption) (*ApiKey, error)
public ApiKey(string name, ApiKeyArgs? args = null, CustomResourceOptions? opts = null)
public ApiKey(String name, ApiKeyArgs args)
public ApiKey(String name, ApiKeyArgs args, CustomResourceOptions options)
type: aws-native:apigateway:ApiKey
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args ApiKeyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args ApiKeyArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ApiKeyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ApiKeyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ApiKeyArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
ApiKey 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 ApiKey resource accepts the following input properties:
- Customer
Id string - An AWS Marketplace customer identifier, when integrating with the AWS SaaS Marketplace.
- Description string
- The description of the ApiKey.
- Enabled bool
- Specifies whether the ApiKey can be used by callers.
- Generate
Distinct boolId - 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. 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 List<Pulumi.Aws Native. Api Gateway. Inputs. Api Key Stage Key> - DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.
- List<Pulumi.
Aws Native. Inputs. Tag> - 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.
- Customer
Id string - An AWS Marketplace customer identifier, when integrating with the AWS SaaS Marketplace.
- Description string
- The description of the ApiKey.
- Enabled bool
- Specifies whether the ApiKey can be used by callers.
- Generate
Distinct boolId - 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. 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 []ApiKey Stage Key Args - DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.
- Tag
Args - 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.
- customer
Id String - An AWS Marketplace 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 BooleanId - 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. 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 List<ApiKey Stage Key> - DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.
- List<Tag>
- 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.
- customer
Id string - An AWS Marketplace 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 booleanId - 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. 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 ApiKey Stage Key[] - DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.
- Tag[]
- 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.
- customer_
id str - An AWS Marketplace customer identifier, when integrating with the AWS SaaS Marketplace.
- description str
- The description of the ApiKey.
- enabled bool
- Specifies whether the ApiKey can be used by callers.
- generate_
distinct_ boolid - 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 str
- 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. 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 Sequence[ApiKey Stage Key Args] - DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.
- Sequence[Tag
Args] - 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 str
- Specifies a value of the API key.
- customer
Id String - An AWS Marketplace 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 BooleanId - 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. 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 List<Property Map> - DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.
- List<Property Map>
- 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.
Outputs
All input properties are implicitly available as output properties. Additionally, the ApiKey resource produces the following output properties:
- api_
key_ strid - The ID for the API key. For example:
abc123
. - id str
- The provider-assigned unique ID for this managed resource.
Supporting Types
ApiKeyStageKey, ApiKeyStageKeyArgs
- rest_
api_ strid - The string identifier of the associated RestApi.
- stage_
name str - The stage name associated with the stage key.
Tag, TagArgs
Package Details
- Repository
- AWS Native pulumi/pulumi-aws-native
- License
- Apache-2.0
We recommend new projects start with resources from the AWS provider.