1. Packages
  2. AWS Native
  3. API Docs
  4. apigateway
  5. ApiKey

AWS Native is in preview. AWS Classic is fully supported.

AWS Native v0.100.0 published on Wednesday, Mar 27, 2024 by Pulumi

aws-native.apigateway.ApiKey

Explore with Pulumi AI

aws-native logo

AWS Native is in preview. AWS Classic is fully supported.

AWS Native v0.100.0 published on Wednesday, Mar 27, 2024 by Pulumi

    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

    new ApiKey(name: string, args?: ApiKeyArgs, opts?: CustomResourceOptions);
    @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)
    @overload
    def ApiKey(resource_name: str,
               args: Optional[ApiKeyArgs] = None,
               opts: Optional[ResourceOptions] = 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.
    
    
    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

    The ApiKey resource accepts the following input properties:

    CustomerId string
    An MKT 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.
    GenerateDistinctId bool
    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.
    StageKeys List<Pulumi.AwsNative.ApiGateway.Inputs.ApiKeyStageKey>
    DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.
    Tags List<Pulumi.AwsNative.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.
    CustomerId string
    An MKT 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.
    GenerateDistinctId bool
    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.
    StageKeys []ApiKeyStageKeyArgs
    DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.
    Tags TagArgs
    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.
    customerId String
    An MKT 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.
    generateDistinctId Boolean
    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.
    stageKeys List<ApiKeyStageKey>
    DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.
    tags 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.
    customerId string
    An MKT 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.
    generateDistinctId boolean
    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.
    stageKeys ApiKeyStageKey[]
    DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.
    tags 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 MKT 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_id bool
    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[ApiKeyStageKeyArgs]
    DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.
    tags TagArgs]
    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.
    customerId String
    An MKT 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.
    generateDistinctId Boolean
    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.
    stageKeys List<Property Map>
    DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.
    tags 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:

    ApiKeyId string
    Id string
    The provider-assigned unique ID for this managed resource.
    ApiKeyId string
    Id string
    The provider-assigned unique ID for this managed resource.
    apiKeyId String
    id String
    The provider-assigned unique ID for this managed resource.
    apiKeyId string
    id string
    The provider-assigned unique ID for this managed resource.
    api_key_id str
    id str
    The provider-assigned unique ID for this managed resource.
    apiKeyId String
    id String
    The provider-assigned unique ID for this managed resource.

    Supporting Types

    ApiKeyStageKey, ApiKeyStageKeyArgs

    RestApiId string
    The string identifier of the associated RestApi.
    StageName string
    The stage name associated with the stage key.
    RestApiId string
    The string identifier of the associated RestApi.
    StageName string
    The stage name associated with the stage key.
    restApiId String
    The string identifier of the associated RestApi.
    stageName String
    The stage name associated with the stage key.
    restApiId string
    The string identifier of the associated RestApi.
    stageName string
    The stage name associated with the stage key.
    rest_api_id str
    The string identifier of the associated RestApi.
    stage_name str
    The stage name associated with the stage key.
    restApiId String
    The string identifier of the associated RestApi.
    stageName String
    The stage name associated with the stage key.

    Tag, TagArgs

    Key string
    The key name of the tag
    Value string
    The value of the tag
    Key string
    The key name of the tag
    Value string
    The value of the tag
    key String
    The key name of the tag
    value String
    The value of the tag
    key string
    The key name of the tag
    value string
    The value of the tag
    key str
    The key name of the tag
    value str
    The value of the tag
    key String
    The key name of the tag
    value String
    The value of the tag

    Package Details

    Repository
    AWS Native pulumi/pulumi-aws-native
    License
    Apache-2.0
    aws-native logo

    AWS Native is in preview. AWS Classic is fully supported.

    AWS Native v0.100.0 published on Wednesday, Mar 27, 2024 by Pulumi