AWS v6.73.0 published on Wednesday, Mar 19, 2025 by Pulumi
aws.apigateway.getKey
Explore with Pulumi AI
Use this data source to get the name and value of a pre-existing API Key, for example to supply credentials for a dependency microservice.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const myApiKey = aws.apigateway.getKey({
    id: "ru3mpjgse6",
});
import pulumi
import pulumi_aws as aws
my_api_key = aws.apigateway.get_key(id="ru3mpjgse6")
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.GetKey(ctx, &apigateway.GetKeyArgs{
			Id: "ru3mpjgse6",
		}, nil)
		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 myApiKey = Aws.ApiGateway.GetKey.Invoke(new()
    {
        Id = "ru3mpjgse6",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.apigateway.ApigatewayFunctions;
import com.pulumi.aws.apigateway.inputs.GetKeyArgs;
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) {
        final var myApiKey = ApigatewayFunctions.getKey(GetKeyArgs.builder()
            .id("ru3mpjgse6")
            .build());
    }
}
variables:
  myApiKey:
    fn::invoke:
      function: aws:apigateway:getKey
      arguments:
        id: ru3mpjgse6
Using getKey
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getKey(args: GetKeyArgs, opts?: InvokeOptions): Promise<GetKeyResult>
function getKeyOutput(args: GetKeyOutputArgs, opts?: InvokeOptions): Output<GetKeyResult>def get_key(id: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None,
            opts: Optional[InvokeOptions] = None) -> GetKeyResult
def get_key_output(id: Optional[pulumi.Input[str]] = None,
            tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
            opts: Optional[InvokeOptions] = None) -> Output[GetKeyResult]func GetKey(ctx *Context, args *GetKeyArgs, opts ...InvokeOption) (*GetKeyResult, error)
func GetKeyOutput(ctx *Context, args *GetKeyOutputArgs, opts ...InvokeOption) GetKeyResultOutput> Note: This function is named GetKey in the Go SDK.
public static class GetKey 
{
    public static Task<GetKeyResult> InvokeAsync(GetKeyArgs args, InvokeOptions? opts = null)
    public static Output<GetKeyResult> Invoke(GetKeyInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetKeyResult> getKey(GetKeyArgs args, InvokeOptions options)
public static Output<GetKeyResult> getKey(GetKeyArgs args, InvokeOptions options)
fn::invoke:
  function: aws:apigateway/getKey:getKey
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Id string
- ID of the API Key to look up.
- Dictionary<string, string>
- Map of tags for the resource.
- Id string
- ID of the API Key to look up.
- map[string]string
- Map of tags for the resource.
- id String
- ID of the API Key to look up.
- Map<String,String>
- Map of tags for the resource.
- id string
- ID of the API Key to look up.
- {[key: string]: string}
- Map of tags for the resource.
- id str
- ID of the API Key to look up.
- Mapping[str, str]
- Map of tags for the resource.
- id String
- ID of the API Key to look up.
- Map<String>
- Map of tags for the resource.
getKey Result
The following output properties are available:
- Arn string
- CreatedDate string
- Date and time when the API Key was created.
- CustomerId string
- Amazon Web Services Marketplace customer identifier, when integrating with the Amazon Web Services SaaS Marketplace.
- Description string
- Description of the API Key.
- Enabled bool
- Whether the API Key is enabled.
- Id string
- Set to the ID of the API Key.
- LastUpdated stringDate 
- Date and time when the API Key was last updated.
- Name string
- Set to the name of the API Key.
- Dictionary<string, string>
- Map of tags for the resource.
- Value string
- Set to the value of the API Key.
- Arn string
- CreatedDate string
- Date and time when the API Key was created.
- CustomerId string
- Amazon Web Services Marketplace customer identifier, when integrating with the Amazon Web Services SaaS Marketplace.
- Description string
- Description of the API Key.
- Enabled bool
- Whether the API Key is enabled.
- Id string
- Set to the ID of the API Key.
- LastUpdated stringDate 
- Date and time when the API Key was last updated.
- Name string
- Set to the name of the API Key.
- map[string]string
- Map of tags for the resource.
- Value string
- Set to the value of the API Key.
- arn String
- createdDate String
- Date and time when the API Key was created.
- customerId String
- Amazon Web Services Marketplace customer identifier, when integrating with the Amazon Web Services SaaS Marketplace.
- description String
- Description of the API Key.
- enabled Boolean
- Whether the API Key is enabled.
- id String
- Set to the ID of the API Key.
- lastUpdated StringDate 
- Date and time when the API Key was last updated.
- name String
- Set to the name of the API Key.
- Map<String,String>
- Map of tags for the resource.
- value String
- Set to the value of the API Key.
- arn string
- createdDate string
- Date and time when the API Key was created.
- customerId string
- Amazon Web Services Marketplace customer identifier, when integrating with the Amazon Web Services SaaS Marketplace.
- description string
- Description of the API Key.
- enabled boolean
- Whether the API Key is enabled.
- id string
- Set to the ID of the API Key.
- lastUpdated stringDate 
- Date and time when the API Key was last updated.
- name string
- Set to the name of the API Key.
- {[key: string]: string}
- Map of tags for the resource.
- value string
- Set to the value of the API Key.
- arn str
- created_date str
- Date and time when the API Key was created.
- customer_id str
- Amazon Web Services Marketplace customer identifier, when integrating with the Amazon Web Services SaaS Marketplace.
- description str
- Description of the API Key.
- enabled bool
- Whether the API Key is enabled.
- id str
- Set to the ID of the API Key.
- last_updated_ strdate 
- Date and time when the API Key was last updated.
- name str
- Set to the name of the API Key.
- Mapping[str, str]
- Map of tags for the resource.
- value str
- Set to the value of the API Key.
- arn String
- createdDate String
- Date and time when the API Key was created.
- customerId String
- Amazon Web Services Marketplace customer identifier, when integrating with the Amazon Web Services SaaS Marketplace.
- description String
- Description of the API Key.
- enabled Boolean
- Whether the API Key is enabled.
- id String
- Set to the ID of the API Key.
- lastUpdated StringDate 
- Date and time when the API Key was last updated.
- name String
- Set to the name of the API Key.
- Map<String>
- Map of tags for the resource.
- value String
- Set to the value of the API Key.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the awsTerraform Provider.