# PartitionKey

Specifies the assignment to the partition key.

It can be
enhanced with the assignment of the sort key.

Extends: [PrimaryKey](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.PrimaryKey.html) › PartitionKey

- Source: [`aws-appsync/lib/key.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-appsync/lib/key.ts#L179)
- Type last changed: v2.60.0 · 12 Jan 2023

## Example

TypeScript:

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

declare const assign: appsync.Assign;
const partitionKey = new appsync.PartitionKey(assign);
```

Python:

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

# assign: appsync.Assign

partition_key = appsync.PartitionKey(assign)
```

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.services.appsync.*;

Assign assign;

PartitionKey partitionKey = new PartitionKey(assign);
```

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.AWS.AppSync;

Assign assign;

var partitionKey = new PartitionKey(assign);
```

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 "github.com/aws/aws-cdk-go/awscdk"

var assign Assign

partitionKey := awscdk.Aws_appsync.NewPartitionKey(assign)
```

## Initializer

TypeScript:

```ts
new PartitionKey(pkey: Assign)
```

Python:

```python
PartitionKey(pkey: Assign)
```

Java:

```java
new PartitionKey(Assign pkey)
```

C# / .NET:

```csharp
new PartitionKey(Assign pkey)
```

Golang:

```go
NewPartitionKey(Pkey Assign)
```

## Methods

- `partition(key: string): PartitionKeyStep` (static) — Allows assigning a value to the partition key.

- `renderTemplate(): string` — Renders the key assignment to a VTL string.

- `sort(key: string): SortKeyStep` — Allows assigning a value to the sort key.
