# AuthenticationMethod

The authentication method to use with SelfManagedKafkaEventSource.

- Source: [`aws-lambda-event-sources/lib/kafka.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-lambda-event-sources/lib/kafka.ts#L144)
- Type last changed: v2.7.0 · 12 Jan 2022

## Example

```ts
import { SelfManagedKafkaEventSource, AuthenticationMethod } from 'aws-cdk-lib/aws-lambda-event-sources';
import { StartingPosition, Function } from 'aws-cdk-lib/aws-lambda';
import { ISecret } from 'aws-cdk-lib/aws-secretsmanager';

// With provisioned pollers and poller group for cost optimization
declare const myFunction: Function;
declare const kafkaCredentials: ISecret;
myFunction.addEventSource(new SelfManagedKafkaEventSource({
  bootstrapServers: ['kafka-broker1.example.com:9092', 'kafka-broker2.example.com:9092'],
  topic: 'events-topic',
  secret: kafkaCredentials,
  startingPosition: StartingPosition.LATEST,
  authenticationMethod: AuthenticationMethod.SASL_SCRAM_512_AUTH,
  provisionedPollerConfig: {
    minimumPollers: 1,
    maximumPollers: 8,
    pollerGroupName: 'self-managed-kafka-group', // Group pollers to reduce costs
  },
}));
```

## Members

| Member | Description |
| --- | --- |
| `SASL_SCRAM_512_AUTH` | SASL_SCRAM_512_AUTH authentication method for your Kafka cluster. |
| `SASL_SCRAM_256_AUTH` | SASL_SCRAM_256_AUTH authentication method for your Kafka cluster. |
| `BASIC_AUTH` | BASIC_AUTH (SASL/PLAIN) authentication method for your Kafka cluster. |
| `CLIENT_CERTIFICATE_TLS_AUTH` | CLIENT_CERTIFICATE_TLS_AUTH (mTLS) authentication method for your Kafka cluster. |

## Referenced by

- [`SelfManagedKafkaEventSourceProps`](/v2/docs/aws-cdk-lib.aws_lambda_event_sources.SelfManagedKafkaEventSourceProps).authenticationMethod
