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

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

aws.apigateway.ApiKey

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

    Provides an API Gateway API Key.

    NOTE: Since the API Gateway usage plans feature was launched on August 11, 2016, usage plans are now required to associate an API key with an API stage.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.apigateway.ApiKey("example", {name: "example"});
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.apigateway.ApiKey("example", name="example")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigateway"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := apigateway.NewApiKey(ctx, "example", &apigateway.ApiKeyArgs{
    			Name: pulumi.String("example"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.ApiGateway.ApiKey("example", new()
        {
            Name = "example",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.apigateway.ApiKey;
    import com.pulumi.aws.apigateway.ApiKeyArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var example = new ApiKey("example", ApiKeyArgs.builder()
                .name("example")
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:apigateway:ApiKey
        properties:
          name: example
    

    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,
               name: Optional[str] = None,
               tags: Optional[Mapping[str, str]] = 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: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.

    Constructor example

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

    var apiKeyResource = new Aws.ApiGateway.ApiKey("apiKeyResource", new()
    {
        CustomerId = "string",
        Description = "string",
        Enabled = false,
        Name = "string",
        Tags = 
        {
            { "string", "string" },
        },
        Value = "string",
    });
    
    example, err := apigateway.NewApiKey(ctx, "apiKeyResource", &apigateway.ApiKeyArgs{
    	CustomerId:  pulumi.String("string"),
    	Description: pulumi.String("string"),
    	Enabled:     pulumi.Bool(false),
    	Name:        pulumi.String("string"),
    	Tags: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Value: pulumi.String("string"),
    })
    
    var apiKeyResource = new ApiKey("apiKeyResource", ApiKeyArgs.builder()
        .customerId("string")
        .description("string")
        .enabled(false)
        .name("string")
        .tags(Map.of("string", "string"))
        .value("string")
        .build());
    
    api_key_resource = aws.apigateway.ApiKey("apiKeyResource",
        customer_id="string",
        description="string",
        enabled=False,
        name="string",
        tags={
            "string": "string",
        },
        value="string")
    
    const apiKeyResource = new aws.apigateway.ApiKey("apiKeyResource", {
        customerId: "string",
        description: "string",
        enabled: false,
        name: "string",
        tags: {
            string: "string",
        },
        value: "string",
    });
    
    type: aws:apigateway:ApiKey
    properties:
        customerId: string
        description: string
        enabled: false
        name: string
        tags:
            string: string
        value: string
    

    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 Amazon Web Services Marketplace customer identifier, when integrating with the Amazon Web Services SaaS Marketplace.
    Description string
    API key description. Defaults to "Managed by Pulumi".
    Enabled bool
    Whether the API key can be used by callers. Defaults to true.
    Name string
    Name of the API key.
    Tags Dictionary<string, string>
    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    Value string
    Value of the API key. If specified, the value must be an alphanumeric string between 20 and 128 characters. If not specified, it will be automatically generated by AWS on creation.
    CustomerId string
    An Amazon Web Services Marketplace customer identifier, when integrating with the Amazon Web Services SaaS Marketplace.
    Description string
    API key description. Defaults to "Managed by Pulumi".
    Enabled bool
    Whether the API key can be used by callers. Defaults to true.
    Name string
    Name of the API key.
    Tags map[string]string
    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    Value string
    Value of the API key. If specified, the value must be an alphanumeric string between 20 and 128 characters. If not specified, it will be automatically generated by AWS on creation.
    customerId String
    An Amazon Web Services Marketplace customer identifier, when integrating with the Amazon Web Services SaaS Marketplace.
    description String
    API key description. Defaults to "Managed by Pulumi".
    enabled Boolean
    Whether the API key can be used by callers. Defaults to true.
    name String
    Name of the API key.
    tags Map<String,String>
    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    value String
    Value of the API key. If specified, the value must be an alphanumeric string between 20 and 128 characters. If not specified, it will be automatically generated by AWS on creation.
    customerId string
    An Amazon Web Services Marketplace customer identifier, when integrating with the Amazon Web Services SaaS Marketplace.
    description string
    API key description. Defaults to "Managed by Pulumi".
    enabled boolean
    Whether the API key can be used by callers. Defaults to true.
    name string
    Name of the API key.
    tags {[key: string]: string}
    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    value string
    Value of the API key. If specified, the value must be an alphanumeric string between 20 and 128 characters. If not specified, it will be automatically generated by AWS on creation.
    customer_id str
    An Amazon Web Services Marketplace customer identifier, when integrating with the Amazon Web Services SaaS Marketplace.
    description str
    API key description. Defaults to "Managed by Pulumi".
    enabled bool
    Whether the API key can be used by callers. Defaults to true.
    name str
    Name of the API key.
    tags Mapping[str, str]
    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    value str
    Value of the API key. If specified, the value must be an alphanumeric string between 20 and 128 characters. If not specified, it will be automatically generated by AWS on creation.
    customerId String
    An Amazon Web Services Marketplace customer identifier, when integrating with the Amazon Web Services SaaS Marketplace.
    description String
    API key description. Defaults to "Managed by Pulumi".
    enabled Boolean
    Whether the API key can be used by callers. Defaults to true.
    name String
    Name of the API key.
    tags Map<String>
    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    value String
    Value of the API key. If specified, the value must be an alphanumeric string between 20 and 128 characters. If not specified, it will be automatically generated by AWS on creation.

    Outputs

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

    Arn string
    ARN
    CreatedDate string
    Creation date of the API key
    Id string
    The provider-assigned unique ID for this managed resource.
    LastUpdatedDate string
    Last update date of the API key
    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
    CreatedDate string
    Creation date of the API key
    Id string
    The provider-assigned unique ID for this managed resource.
    LastUpdatedDate string
    Last update date of the API key
    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
    createdDate String
    Creation date of the API key
    id String
    The provider-assigned unique ID for this managed resource.
    lastUpdatedDate String
    Last update date of the API key
    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
    createdDate string
    Creation date of the API key
    id string
    The provider-assigned unique ID for this managed resource.
    lastUpdatedDate string
    Last update date of the API key
    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
    created_date str
    Creation date of the API key
    id str
    The provider-assigned unique ID for this managed resource.
    last_updated_date str
    Last update date of the API key
    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
    createdDate String
    Creation date of the API key
    id String
    The provider-assigned unique ID for this managed resource.
    lastUpdatedDate String
    Last update date of the API key
    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 ApiKey Resource

    Get an existing ApiKey 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?: ApiKeyState, opts?: CustomResourceOptions): ApiKey
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            arn: Optional[str] = None,
            created_date: Optional[str] = None,
            customer_id: Optional[str] = None,
            description: Optional[str] = None,
            enabled: Optional[bool] = None,
            last_updated_date: Optional[str] = None,
            name: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None,
            tags_all: Optional[Mapping[str, str]] = None,
            value: Optional[str] = None) -> ApiKey
    func GetApiKey(ctx *Context, name string, id IDInput, state *ApiKeyState, opts ...ResourceOption) (*ApiKey, error)
    public static ApiKey Get(string name, Input<string> id, ApiKeyState? state, CustomResourceOptions? opts = null)
    public static ApiKey get(String name, Output<String> id, ApiKeyState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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:
    Arn string
    ARN
    CreatedDate string
    Creation date of the API key
    CustomerId string
    An Amazon Web Services Marketplace customer identifier, when integrating with the Amazon Web Services SaaS Marketplace.
    Description string
    API key description. Defaults to "Managed by Pulumi".
    Enabled bool
    Whether the API key can be used by callers. Defaults to true.
    LastUpdatedDate string
    Last update date of the API key
    Name string
    Name of the API key.
    Tags Dictionary<string, string>
    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    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.

    Value string
    Value of the API key. If specified, the value must be an alphanumeric string between 20 and 128 characters. If not specified, it will be automatically generated by AWS on creation.
    Arn string
    ARN
    CreatedDate string
    Creation date of the API key
    CustomerId string
    An Amazon Web Services Marketplace customer identifier, when integrating with the Amazon Web Services SaaS Marketplace.
    Description string
    API key description. Defaults to "Managed by Pulumi".
    Enabled bool
    Whether the API key can be used by callers. Defaults to true.
    LastUpdatedDate string
    Last update date of the API key
    Name string
    Name of the API key.
    Tags map[string]string
    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    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.

    Value string
    Value of the API key. If specified, the value must be an alphanumeric string between 20 and 128 characters. If not specified, it will be automatically generated by AWS on creation.
    arn String
    ARN
    createdDate String
    Creation date of the API key
    customerId String
    An Amazon Web Services Marketplace customer identifier, when integrating with the Amazon Web Services SaaS Marketplace.
    description String
    API key description. Defaults to "Managed by Pulumi".
    enabled Boolean
    Whether the API key can be used by callers. Defaults to true.
    lastUpdatedDate String
    Last update date of the API key
    name String
    Name of the API key.
    tags Map<String,String>
    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    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.

    value String
    Value of the API key. If specified, the value must be an alphanumeric string between 20 and 128 characters. If not specified, it will be automatically generated by AWS on creation.
    arn string
    ARN
    createdDate string
    Creation date of the API key
    customerId string
    An Amazon Web Services Marketplace customer identifier, when integrating with the Amazon Web Services SaaS Marketplace.
    description string
    API key description. Defaults to "Managed by Pulumi".
    enabled boolean
    Whether the API key can be used by callers. Defaults to true.
    lastUpdatedDate string
    Last update date of the API key
    name string
    Name of the API key.
    tags {[key: string]: string}
    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    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.

    value string
    Value of the API key. If specified, the value must be an alphanumeric string between 20 and 128 characters. If not specified, it will be automatically generated by AWS on creation.
    arn str
    ARN
    created_date str
    Creation date of the API key
    customer_id str
    An Amazon Web Services Marketplace customer identifier, when integrating with the Amazon Web Services SaaS Marketplace.
    description str
    API key description. Defaults to "Managed by Pulumi".
    enabled bool
    Whether the API key can be used by callers. Defaults to true.
    last_updated_date str
    Last update date of the API key
    name str
    Name of the API key.
    tags Mapping[str, str]
    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    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.

    value str
    Value of the API key. If specified, the value must be an alphanumeric string between 20 and 128 characters. If not specified, it will be automatically generated by AWS on creation.
    arn String
    ARN
    createdDate String
    Creation date of the API key
    customerId String
    An Amazon Web Services Marketplace customer identifier, when integrating with the Amazon Web Services SaaS Marketplace.
    description String
    API key description. Defaults to "Managed by Pulumi".
    enabled Boolean
    Whether the API key can be used by callers. Defaults to true.
    lastUpdatedDate String
    Last update date of the API key
    name String
    Name of the API key.
    tags Map<String>
    Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    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.

    value String
    Value of the API key. If specified, the value must be an alphanumeric string between 20 and 128 characters. If not specified, it will be automatically generated by AWS on creation.

    Import

    Using pulumi import, import API Gateway Keys using the id. For example:

    $ pulumi import aws:apigateway/apiKey:ApiKey example 8bklk8bl1k3sB38D9B3l0enyWT8c09B30lkq0blk
    

    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.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi