Step 1: Create a Service-Linked Role (AWS CLI) - Amazon Lex V1

If you are using Amazon Lex V2, refer to the Amazon Lex V2 guide instead.

 

If you are using Amazon Lex V1, we recommend upgrading your bots to Amazon Lex V2. We are no longer adding new features to V1 and strongly recommend using V2 for all new bots.

Step 1: Create a Service-Linked Role (AWS CLI)

Amazon Lex assumes AWS Identity and Access Management service-linked roles to call AWS services on behalf of your bots. The roles, which are in your account, are linked to Amazon Lex use cases and have predefined permissions. For more information, see Using Service-Linked Roles for Amazon Lex.

If you've already created an Amazon Lex bot using the console, the service-linked role was created automatically. Skip to Step 2: Create a Custom Slot Type (AWS CLI).

To create a service-linked role (AWS CLI)
  1. In the AWS CLI, type the following command:

    aws iam create-service-linked-role --aws-service-name lex.amazonaws.com
  2. Check the policy using the following command:

    aws iam get-role --role-name AWSServiceRoleForLexBots

    The response is:

    {
        "Role": {
            "AssumeRolePolicyDocument": {
                "Version": "2012-10-17", 
                "Statement": [
                    {
                        "Action": "sts:AssumeRole", 
                        "Effect": "Allow", 
                        "Principal": {
                            "Service": "lex.amazonaws.com"
                        }
                    }
                ]
            },
            "RoleName": "AWSServiceRoleForLexBots", 
            "Path": "/aws-service-role/lex.amazonaws.com/", 
            "Arn": "arn:aws:iam::account-id:role/aws-service-role/lex.amazonaws.com/AWSServiceRoleForLexBots"
    }

Next Step

Step 2: Create a Custom Slot Type (AWS CLI)