

# IAM profile

You can configure a named profile to connect to Amazon Athena using the ODBC driver. You can use a named profile with one of the following credential sources:
+ `Ec2InstanceMetadata` – Retrieves credentials from the Amazon EC2 Instance Metadata Service (IMDS). Use this when running on an Amazon EC2 instance.
+ `EcsContainer` – Retrieves credentials from the Amazon ECS Task Role endpoint. Use this when running in an Amazon ECS container.
+ `Environment` – Retrieves credentials from environment variables (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN`).

To use `credential_source`, also set `role_arn` in your AWS profile configuration to the IAM role to assume. Set `credential_source` to the appropriate value for your environment. To use a custom credentials provider instead, set `plugin_name` in your profile configuration.

The profile provider reuses its current credentials while they remain valid. Open a new connection after changing the profile configuration.

## Authentication type
<a name="odbc-v4-driver-iam-profile-authentication-type"></a>



| **Connection string name** | **Parameter type** | **Default value** | **Connection string example** | 
| --- | --- | --- | --- | 
| AuthenticationType | Required | IAM Credentials | AuthenticationType=IAM Profile; | 

## AWS profile
<a name="odbc-v4-driver-iam-profile-aws-profile"></a>

The profile name to use for your ODBC connection. For more information about profiles, see [Using named profiles](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html#cli-configure-files-using-profiles) in the *AWS Command Line Interface User Guide*.



| **Connection string name** | **Parameter type** | **Default value** | **Connection string example** | 
| --- | --- | --- | --- | 
| AwsProfile | Optional | default | AwsProfile=default; | 

## Preferred role
<a name="odbc-v4-driver-iam-profile-preferred-role"></a>

The Amazon Resource Name (ARN) of the role to assume. The preferred role parameter is used when the custom credentials provider is specified by the `plugin_name` parameter in your profile configuration. For more information about ARN roles, see [AssumeRole](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html) in the *AWS Security Token Service API Reference*. 



| **Connection string name** | **Parameter type** | **Default value** | **Connection string example** | 
| --- | --- | --- | --- | 
| preferred\_role | Optional | none | preferred\_role=arn:aws:iam::123456789012:role/MyAthenaRole; | 

## Session duration
<a name="odbc-v4-driver-iam-profile-session-duration"></a>

The session duration in seconds for the custom provider selected by `plugin_name`. The driver does not assign a default to this profile parameter.



| **Connection string name** | **Parameter type** | **Default value** | **Connection string example** | 
| --- | --- | --- | --- | 
| duration | Optional | Not set | duration=900; | 

## Plugin name
<a name="odbc-v4-driver-iam-profile-plugin-name"></a>

Specifies a custom provider in a named profile. Supported values are `AzureAD`, `BrowserAzureAD`, `Ping`, `ADFS`, `Okta`, `BrowserSAML`, `JWT`, `BrowserSSOOIDC`, and `External Credentials`. Configure this parameter in the profile, rather than the connection string.



| **Connection string name** | **Parameter type** | **Default value** | **Connection string example** | 
| --- | --- | --- | --- | 
| plugin\_name | Optional | none | plugin\_name=AzureAD; | 