# AliasOptions

Options for `lambda.Alias`.

Extends: [EventInvokeConfigOptions](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.EventInvokeConfigOptions.html)

- Source: [`aws-lambda/lib/alias.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-lambda/lib/alias.ts#L39)

## 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_lambda as lambda } from 'aws-cdk-lib';

declare const destination: lambda.IDestination;
declare const version: lambda.Version;
const aliasOptions: lambda.AliasOptions = {
  additionalVersions: [{
    version: version,
    weight: 123,
  }],
  description: 'description',
  maxEventAge: cdk.Duration.minutes(30),
  onFailure: destination,
  onSuccess: destination,
  provisionedConcurrentExecutions: 123,
  retryAttempts: 123,
};
```

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_lambda as lambda_

# destination: lambda.IDestination
# version: lambda.Version

alias_options = lambda.AliasOptions(
    additional_versions=[lambda.VersionWeight(
        version=version,
        weight=123
    )],
    description="description",
    max_event_age=cdk.Duration.minutes(30),
    on_failure=destination,
    on_success=destination,
    provisioned_concurrent_executions=123,
    retry_attempts=123
)
```

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.lambda.*;

IDestination destination;
Version version;

AliasOptions aliasOptions = AliasOptions.builder()
        .additionalVersions(List.of(VersionWeight.builder()
                .version(version)
                .weight(123)
                .build()))
        .description("description")
        .maxEventAge(Duration.minutes(30))
        .onFailure(destination)
        .onSuccess(destination)
        .provisionedConcurrentExecutions(123)
        .retryAttempts(123)
        .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.Lambda;

IDestination destination;
Version version;

var aliasOptions = new AliasOptions {
    AdditionalVersions = new [] { new VersionWeight {
        Version = version,
        Weight = 123
    } },
    Description = "description",
    MaxEventAge = Duration.Minutes(30),
    OnFailure = destination,
    OnSuccess = destination,
    ProvisionedConcurrentExecutions = 123,
    RetryAttempts = 123
};
```

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 destination IDestination
var version Version

aliasOptions := &AliasOptions{
	AdditionalVersions: []VersionWeight{
		&VersionWeight{
			Version: version,
			Weight: jsii.Number(123),
		},
	},
	Description: jsii.String("description"),
	MaxEventAge: cdk.Duration_Minutes(jsii.Number(30)),
	OnFailure: destination,
	OnSuccess: destination,
	ProvisionedConcurrentExecutions: jsii.Number(123),
	RetryAttempts: jsii.Number(123),
}
```

## Properties

- `additionalVersions`: [VersionWeight](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.VersionWeight.html)[] — Additional versions with individual weights this alias points to.

  **Default:** No additional versions

  Individual additional version weights specified here should add up to
  (less than) one. All remaining weight is routed to the default
  version.

  For example, the config is

     version: "1"
     additionalVersions: [{ version: "2", weight: 0.05 }]

  Then 5% of traffic will be routed to function version 2, while
  the remaining 95% of traffic will be routed to function version 1.

- `description`: string — Description for the alias.

  **Default:** No description

- `maxEventAge`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = Duration.hours(6) — The maximum age of a request that Lambda sends to a function for processing.

  Minimum: 60 seconds
  Maximum: 6 hours

- `onFailure`: [IDestination](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.IDestination.html) — The destination for failed invocations.

  **Default:** no destination

- `onSuccess`: [IDestination](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.IDestination.html) — The destination for successful invocations.

  **Default:** no destination

- `provisionedConcurrentExecutions`: number — Specifies a provisioned concurrency configuration for a function's alias.

  **Default:** No provisioned concurrency

- `retryAttempts`: number = 2 — The maximum number of times to retry when the function returns an error.

  Minimum: 0
  Maximum: 2
