# AppSyncApiKeyConfig

Configuration for API Key authorization in AppSync.

- Source: [`aws-appsync/lib/auth-config.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-appsync/lib/auth-config.ts#L87)
- Type last changed: v2.178.0 · 6 Feb 2025

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_appsync as appsync } from 'aws-cdk-lib';

declare const expiration: cdk.Expiration;
const appSyncApiKeyConfig: appsync.AppSyncApiKeyConfig = {
  description: 'description',
  expires: expiration,
  name: 'name',
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_appsync as appsync

# expiration: cdk.Expiration

app_sync_api_key_config = appsync.AppSyncApiKeyConfig(
    description="description",
    expires=expiration,
    name="name"
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.appsync.*;

Expiration expiration;

AppSyncApiKeyConfig appSyncApiKeyConfig = AppSyncApiKeyConfig.builder()
        .description("description")
        .expires(expiration)
        .name("name")
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.AppSync;

Expiration expiration;

var appSyncApiKeyConfig = new AppSyncApiKeyConfig {
    Description = "description",
    Expires = expiration,
    Name = "name"
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var expiration Expiration

appSyncApiKeyConfig := &AppSyncApiKeyConfig{
	Description: jsii.String("description"),
	Expires: expiration,
	Name: jsii.String("name"),
}
```

## Properties

- `description`: string — Description of API key.

  **Default:** 'Default API Key created by CDK'

- `expires`: [Expiration](/cdk/api/v2/docs/aws-cdk-lib.Expiration.html) — The time from creation time after which the API key expires.

  **Default:** 7 days rounded down to nearest hour

  It must be a minimum of 1 day and a maximum of 365 days from date of creation.
  Rounded down to the nearest hour.

- `name`: string = 'DefaultAPIKey' — Unique name of the API Key.
