# SnapStartConf

Obtainable from: SnapStartConf.ON_PUBLISHED_VERSIONS

- Source: [`aws-lambda/lib/snapstart-config.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-lambda/lib/snapstart-config.ts#L3)
- Type last changed: v2.94.0 · 1 Sep 2023

## Example

TypeScript:

```ts
const fn = new lambda.Function(this, 'MyFunction', {
  code: lambda.Code.fromAsset(path.join(__dirname, 'handler.zip')),
  runtime: lambda.Runtime.JAVA_11,
  handler: 'example.Handler::handleRequest',
  snapStart: lambda.SnapStartConf.ON_PUBLISHED_VERSIONS,
  });

const version = fn.currentVersion;
```

Python:

```python
fn = lambda_.Function(self, "MyFunction",
    code=lambda_.Code.from_asset(path.join(__dirname, "handler.zip")),
    runtime=lambda_.Runtime.JAVA_11,
    handler="example.Handler::handleRequest",
    snap_start=lambda_.SnapStartConf.ON_PUBLISHED_VERSIONS
)

version = fn.current_version
```

Java:

```java
Function fn = Function.Builder.create(this, "MyFunction")
        .code(Code.fromAsset(join(__dirname, "handler.zip")))
        .runtime(Runtime.JAVA_11)
        .handler("example.Handler::handleRequest")
        .snapStart(SnapStartConf.ON_PUBLISHED_VERSIONS)
        .build();

Version version = fn.getCurrentVersion();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var fn = new Function(this, "MyFunction", new FunctionProps {
    Code = Code.FromAsset(Join(__dirname, "handler.zip")),
    Runtime = Runtime.JAVA_11,
    Handler = "example.Handler::handleRequest",
    SnapStart = SnapStartConf.ON_PUBLISHED_VERSIONS
});

var version = fn.CurrentVersion;
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
fn := lambda.NewFunction(this, jsii.String("MyFunction"), &FunctionProps{
	Code: lambda.Code_FromAsset(path.join(__dirname, jsii.String("handler.zip"))),
	Runtime: lambda.Runtime_JAVA_11(),
	Handler: jsii.String("example.Handler::handleRequest"),
	SnapStart: lambda.SnapStartConf_ON_PUBLISHED_VERSIONS(),
})

version := fn.currentVersion
```

## Initializer

TypeScript:

```ts
new SnapStartConf()
```

Python:

```python
SnapStartConf()
```

Java:

```java
new SnapStartConf()
```

C# / .NET:

```csharp
new SnapStartConf()
```

Golang:

```go
NewSnapStartConf()
```

## Properties

- `ON_PUBLISHED_VERSIONS`: [SnapStartConf](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.SnapStartConf.html) (static)
