

# Importing bots in Lex V2
<a name="import"></a>

To use the console to import a previously exported bot, bot locale or custom vocabulary, you provide the file location on your local computer and the optional password to unlock the file. For an example, see [Importing a Lex V2 bot (console)](import-console.md).

When you use the API, importing a resource is a three step process:

1. Create an upload URL using the `CreateUploadUrl` operation. You don't need to create an upload URL when you are using the console.

1. Upload the .zip file that contains the resource definition.

1. Start the import with the `StartImport` operation.

The upload URL is a pre-signed Amazon S3 URL with write permission. The URL is available for five minutes after it is generated. If you password protect the .zip file, you must provide the password when you start the import. For more information, see [Using a password when importing or exporting](import-export-password.md).

An import is an asynchronous process. You can monitor the progress of an import using the console or the `DescribeImport` operation. 

When you import a bot or bot locale, there may be conflicts between resource names in the import file and existing resource names in Amazon Lex V2. Amazon Lex V2 can handle the conflict in three ways:
+ **Fail on conflict** – The import stops and no resources are imported from the import .zip file.
+ **Overwrite** – Amazon Lex V2 imports all of the resources from the import .zip file and replaces any existing resource with the definition from the import file. 
+ **Append** – Amazon Lex V2 imports all of the resources from the import .zip file and adds to any existing resource with the definition from the import file. This is available only for the bot locale. 

You can see a list of the imports to a resource using the console or the `ListImports` operation. Imports remain in the list for seven days. You can use the console or the `DescribeImport` operation to see details about a specific import.

You can also remove an import and the associated .zip file using the console or the `DeleteImport` operation.

For an example of importing a bot using the console, see [Importing a Lex V2 bot (console)](import-console.md).

## IAM permissions required to import
<a name="import-permissions"></a>

To import bots, bot locales, and custom vocabularies, the user running the import must have the following IAM permissions. 


| API | Required IAM actions | Resource | 
| --- | --- | --- | 
| [CreateUploadUrl](https://docs.aws.amazon.com/lexv2/latest/APIReference/API_CreateUploadUrl.html) | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/lexv2/latest/dg/import.html) | \$1 | 
| [StartImport](https://docs.aws.amazon.com/lexv2/latest/APIReference/API_StartImport.html) for bot and bot locale | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/lexv2/latest/dg/import.html) | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/lexv2/latest/dg/import.html) | 
| [StartImport](https://docs.aws.amazon.com/lexv2/latest/APIReference/API_StartImport.html) for custom vocabularies | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/lexv2/latest/dg/import.html)  | bot | 
| [DescribeImport](https://docs.aws.amazon.com/lexv2/latest/APIReference/API_DescribeImport.html) | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/lexv2/latest/dg/import.html) | Bot | 
| [DeleteImport](https://docs.aws.amazon.com/lexv2/latest/APIReference/API_DeleteImport.html) | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/lexv2/latest/dg/import.html) | Bot | 
| [ListImports](https://docs.aws.amazon.com/lexv2/latest/APIReference/API_ListImports.html) | [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/lexv2/latest/dg/import.html) | \$1 | 

For an example IAM policy, see [Allow a user to import bots and bot locales](security_iam_id-based-policy-examples.md#security_iam_id-based-policy-examples-import).

# Importing a Lex V2 bot (console)
<a name="import-console"></a>

**To import a bot using the console**

1. Sign in to the AWS Management Console and open the Amazon Lex V2 console at [https://console.aws.amazon.com/lexv2/home](https://console.aws.amazon.com/lexv2/home).

1. From **Action**, choose **Import**.

1. In **Input file**, give the bot a name and then choose the .zip file that contains the JSON files that define the bot.

1. If the .zip file is password protected, enter the password for the .zip file. Password protecting the archive is optional, but it helps protect the contents.

1. Create or enter the IAM role that defines permissions for your bot.

1. Indicate whether your bot is subject to the Children's Online Privacy Protection Act (COPPA).

1. Provide an idle timeout setting for your bot. If you don't provide a value, the value from the zip file is used. If the .zip file does not contain a timeout setting, Amazon Lex V2 uses the default of 300 seconds (five minutes).

1. (Optional) Add tags for your bot.

1. Choose whether to warn about overwriting existing bots with the same name. If you enable warnings, if the bot you are importing would overwrite an existing bot, you receive a warning and the bot is not imported. If you disable warnings, the imported bot replaces the existing bot with the same name.

1. Choose **Import**.

After you start the import, you return to the list of bots. To monitor the progress of the import, use the **Import/export history** list. When the status of the import is **Complete**, you can choose the bot from the list of bots to modify or build the bot. 

**To import a bot language**

1. Sign in to the AWS Management Console and open the Amazon Lex V2 console at [https://console.aws.amazon.com/lexv2/home](https://console.aws.amazon.com/lexv2/home).

1. From the list of bots, choose the bot to which you want to import a language.

1. From **Add languages**, choose **View languages**.

1. From **Action**, choose **import**.

1. In **Input file**, choose the file that contains the language to import. If you protected the .zip file, provide the password in **Password**.

1. In **Language**, choose the language to import as. The language doesn't have to match the language in the import file. You can copy the intents from one language to another.

1. In **Voice**, choose the Amazon Polly voice to use for voice interaction, or choose **None** for a text-only bot.

1. In **Confidence score threshold**, enter the threshold where Amazon Lex V2 inserts the `AMAZON.FallbackIntent`, the `AMAZON.KendraSearchIntent`, or both when returning alternative intents.

1. Choose whether to warn about overwriting an existing language. If you enable warnings, if the language you are importing would overwrite an existing language, you receive a warning and the language is not imported. If you disable warnings, the imported language replaces the existing language.

1. Choose **Import** to start importing the language.

After you start the import, you return to the list of languages. To monitor the progress of the import, use the **Import/export history** list. When the status of the import is **Complete**, you can choose the language from the list of bots to modify or build the bot. 