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

aws.appsync.ApiKey

Explore with Pulumi AI

Provides an AppSync API Key.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.appsync.GraphQLApi("example", {
    authenticationType: "API_KEY",
    name: "example",
});
const exampleApiKey = new aws.appsync.ApiKey("example", {
    apiId: example.id,
    expires: "2018-05-03T04:00:00Z",
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.appsync.GraphQLApi("example",
    authentication_type="API_KEY",
    name="example")
example_api_key = aws.appsync.ApiKey("example",
    api_id=example.id,
    expires="2018-05-03T04:00:00Z")
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appsync"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := appsync.NewGraphQLApi(ctx, "example", &appsync.GraphQLApiArgs{
			AuthenticationType: pulumi.String("API_KEY"),
			Name:               pulumi.String("example"),
		})
		if err != nil {
			return err
		}
		_, err = appsync.NewApiKey(ctx, "example", &appsync.ApiKeyArgs{
			ApiId:   example.ID(),
			Expires: pulumi.String("2018-05-03T04:00:00Z"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.AppSync.GraphQLApi("example", new()
    {
        AuthenticationType = "API_KEY",
        Name = "example",
    });

    var exampleApiKey = new Aws.AppSync.ApiKey("example", new()
    {
        ApiId = example.Id,
        Expires = "2018-05-03T04:00:00Z",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.appsync.GraphQLApi;
import com.pulumi.aws.appsync.GraphQLApiArgs;
import com.pulumi.aws.appsync.ApiKey;
import com.pulumi.aws.appsync.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 GraphQLApi("example", GraphQLApiArgs.builder()
            .authenticationType("API_KEY")
            .name("example")
            .build());

        var exampleApiKey = new ApiKey("exampleApiKey", ApiKeyArgs.builder()
            .apiId(example.id())
            .expires("2018-05-03T04:00:00Z")
            .build());

    }
}
Copy
resources:
  example:
    type: aws:appsync:GraphQLApi
    properties:
      authenticationType: API_KEY
      name: example
  exampleApiKey:
    type: aws:appsync:ApiKey
    name: example
    properties:
      apiId: ${example.id}
      expires: 2018-05-03T04:00:00Z
Copy

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: ApiKeyArgs,
           opts: Optional[ResourceOptions] = None)

@overload
def ApiKey(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           api_id: Optional[str] = None,
           description: Optional[str] = None,
           expires: Optional[str] = None)
func NewApiKey(ctx *Context, name string, args ApiKeyArgs, opts ...ResourceOption) (*ApiKey, error)
public ApiKey(string name, ApiKeyArgs args, CustomResourceOptions? opts = null)
public ApiKey(String name, ApiKeyArgs args)
public ApiKey(String name, ApiKeyArgs args, CustomResourceOptions options)
type: aws:appsync:ApiKey
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 This property is required. ApiKeyArgs
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 This property is required. 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 This property is required. string
The unique name of the resource.
args This property is required. ApiKeyArgs
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 This property is required. ApiKeyArgs
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. 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 awsApiKeyResource = new Aws.AppSync.ApiKey("awsApiKeyResource", new()
{
    ApiId = "string",
    Description = "string",
    Expires = "string",
});
Copy
example, err := appsync.NewApiKey(ctx, "awsApiKeyResource", &appsync.ApiKeyArgs{
	ApiId:       pulumi.String("string"),
	Description: pulumi.String("string"),
	Expires:     pulumi.String("string"),
})
Copy
var awsApiKeyResource = new ApiKey("awsApiKeyResource", ApiKeyArgs.builder()
    .apiId("string")
    .description("string")
    .expires("string")
    .build());
Copy
aws_api_key_resource = aws.appsync.ApiKey("awsApiKeyResource",
    api_id="string",
    description="string",
    expires="string")
Copy
const awsApiKeyResource = new aws.appsync.ApiKey("awsApiKeyResource", {
    apiId: "string",
    description: "string",
    expires: "string",
});
Copy
type: aws:appsync:ApiKey
properties:
    apiId: string
    description: string
    expires: string
Copy

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:

ApiId This property is required. string
ID of the associated AppSync API
Description string
API key description. Defaults to "Managed by Pulumi".
Expires string
RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
ApiId This property is required. string
ID of the associated AppSync API
Description string
API key description. Defaults to "Managed by Pulumi".
Expires string
RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
apiId This property is required. String
ID of the associated AppSync API
description String
API key description. Defaults to "Managed by Pulumi".
expires String
RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
apiId This property is required. string
ID of the associated AppSync API
description string
API key description. Defaults to "Managed by Pulumi".
expires string
RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
api_id This property is required. str
ID of the associated AppSync API
description str
API key description. Defaults to "Managed by Pulumi".
expires str
RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
apiId This property is required. String
ID of the associated AppSync API
description String
API key description. Defaults to "Managed by Pulumi".
expires String
RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.

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.
Key string
API key
ApiKeyId string
Id string
The provider-assigned unique ID for this managed resource.
Key string
API key
apiKeyId String
id String
The provider-assigned unique ID for this managed resource.
key String
API key
apiKeyId string
id string
The provider-assigned unique ID for this managed resource.
key string
API key
api_key_id str
id str
The provider-assigned unique ID for this managed resource.
key str
API key
apiKeyId String
id String
The provider-assigned unique ID for this managed resource.
key String
API key

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,
        api_id: Optional[str] = None,
        api_key_id: Optional[str] = None,
        description: Optional[str] = None,
        expires: Optional[str] = None,
        key: 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)
resources:  _:    type: aws:appsync:ApiKey    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:
ApiId string
ID of the associated AppSync API
ApiKeyId string
Description string
API key description. Defaults to "Managed by Pulumi".
Expires string
RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
Key string
API key
ApiId string
ID of the associated AppSync API
ApiKeyId string
Description string
API key description. Defaults to "Managed by Pulumi".
Expires string
RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
Key string
API key
apiId String
ID of the associated AppSync API
apiKeyId String
description String
API key description. Defaults to "Managed by Pulumi".
expires String
RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
key String
API key
apiId string
ID of the associated AppSync API
apiKeyId string
description string
API key description. Defaults to "Managed by Pulumi".
expires string
RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
key string
API key
api_id str
ID of the associated AppSync API
api_key_id str
description str
API key description. Defaults to "Managed by Pulumi".
expires str
RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
key str
API key
apiId String
ID of the associated AppSync API
apiKeyId String
description String
API key description. Defaults to "Managed by Pulumi".
expires String
RFC3339 string representation of the expiry date. Rounded down to nearest hour. By default, it is 7 days from the date of creation.
key String
API key

Import

Using pulumi import, import aws_appsync_api_key using the AppSync API ID and key separated by :. For example:

$ pulumi import aws:appsync/apiKey:ApiKey example xxxxx:yyyyy
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.