# AWS Elastic Container Service with KSM (Advanced)

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2F3kFZhdXIOYTbTYZDHfGx%2FKeeper%20Automator.jpg?alt=media&#x26;token=a0068e4d-af6c-4b72-a798-acfbca2227b4" alt=""><figcaption></figcaption></figure>

## Overview

This example demonstrates how to launch the Keeper Automator service in Amazon ECS with Fargate, while also demonstrating the use of Keeper Secrets Manager for retrieving the secret configuration for the published Docker container.

## Keeper Setup

Since this deployment requires the use of Keeper Secrets Manager, this section reviews the steps needed to set up your Keeper vault and the SSL certificate for publishing the Automator service.

### **(1) SSL Certificate**

Create an SSL Certificate as described [from this page](https://docs.keeper.io/en/sso-connect-cloud/device-approvals/automator/custom-ssl-certificate)

When this step is completed, you will have two files: `ssl-certificate.pfx` and `ssl-certificate-password.txt`

### **(2)** Create Shared Folder

Create a Shared Folder in your vault. This folder will not be shared to anyone except the secrets manager application.

### **(3)** Add File Attachments

Create a record in the Shared Folder, and make note of the Record UID. Upload the SSL certificate and SSL certificate password files to a Keeper record in the shared folder.

### **(4)** Add Automator Property File

Upload a new file called keeper.properties which contains the following content:

```
ssl_mode=certificate
ssl_certificate_file=/config/ssl-certificate.pfx
ssl_certificate_file_password=
ssl_certificate_key_password=
automator_host=localhost
automator_port=443
disable_sni_check=true
persist_state=true
```

The notable line here is the `disable_sni_check=true` which is necessary when running the Automator service under a managed load balancer.

Your shared folder and record should look something like this:

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FVbTbHWg5VgJsu1eJcpLp%2FScreenshot%202023-07-12%20at%2011.56.06%20AM.jpg?alt=media&#x26;token=f83d9571-cf64-4e36-9bb7-de0b80523c0b" alt=""><figcaption><p>Shared Folder containing a record with 3 files</p></figcaption></figure>

### **(5)** Create KSM Application

Create a Keeper Secrets Manager ("KSM") application in your vault. If you are not familiar with secrets manager, [follow this guide](https://docs.keeper.io/keeperpam/secrets-manager/quick-start-guide). The name of this application is "Automator" but the name does not matter.

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FzbLUxlZAPYg8akfsIirm%2FScreenshot%202023-07-12%20at%2012.01.46%20PM.jpg?alt=media&#x26;token=41131fa4-4b0a-4622-b065-e1d9d44d2f41" alt=""><figcaption><p>KSM Application</p></figcaption></figure>

### **(6)** Attach the KSM application to the shared folder

Edit the Shared Folder and add the Automator application to this folder.

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2F9ibLLYqDnnAnOJYRaTnx%2FScreenshot%202023-07-12%20at%2011.57.47%20AM.jpg?alt=media&#x26;token=36cd6e24-86e7-4ca9-a392-f2efeaae9647" alt=""><figcaption><p>Assign Application to Shared Folder</p></figcaption></figure>

### **(7)** Create a KSM Device Configuration

Open the secrets manager application, click on "Devices" tab and click "Add Device". Select a **base64** configuration. Download and save this configuration for use in the ECS task definition.

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2Fpc5ikpy1dnhALSSCHJ1m%2FScreenshot%202023-07-12%20at%2012.02.21%20PM.jpg?alt=media&#x26;token=2eb276de-3fda-4f6e-b3ee-a7d2b9762242" alt=""><figcaption><p>Create base64 configuration</p></figcaption></figure>

## AWS Setup

### (1) Create a VPC

If your VPC does not exist, a basic VPC with multiple subnets, a route table and internet gateway must be set up. In this example, there are 3 subnets in the VPC with an internet gateway as seen in the resource map below:

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2F9KzPDgaRyS0pb6Rdmprz%2FScreenshot%202023-04-16%20at%2011.48.19%20AM.png?alt=media&#x26;token=7be5fc3d-efc3-4774-a3a2-11e8d8a83b5f" alt=""><figcaption><p>VPC Setup</p></figcaption></figure>

### (2) Create CloudWatch Log Group

Go to CloudWatch > Create log group

Name the log group "**automator-logs**".

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FduoVKiCTtdZIpnwBeQG1%2FScreenshot%202023-04-16%20at%2012.11.45%20PM.png?alt=media&#x26;token=3440fb29-65f3-4982-a1d9-3d633ad93d7c" alt=""><figcaption><p>Create CloudWatch Log Group</p></figcaption></figure>

### (3) Create an Execution IAM Role

Go to IAM > Create role

Select AWS service

Then search for Elastic Container Service and select it.

Select "Elastic Container Service Task" and click Next

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FY299VofMs6mjkh1XxL9Q%2FScreenshot%202023-04-16%20at%2010.34.41%20AM.png?alt=media&#x26;token=9078a2b7-8d38-437a-8aa5-c750ee081e48" alt=""><figcaption></figcaption></figure>

Add the "AmazonECSTaskExecution" policy to the role and click Next

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FuGRHj9wzDVWl7zVT4x4s%2FScreenshot%202023-04-16%20at%2010.35.02%20AM.png?alt=media&#x26;token=f0e64e9c-78ad-4420-898a-9a569e699445" alt=""><figcaption></figcaption></figure>

Assign the name "**ECSTaskWritetoLogs**" and then create the role.

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FcCHhl5Ni7pAkJvoRWICs%2FScreenshot%202023-04-16%20at%2010.35.29%20AM.png?alt=media&#x26;token=1a2d9273-6fe6-488a-aa7d-2fecb7b3bad0" alt=""><figcaption></figcaption></figure>

Make note of the ARN for this Role, as it will be used in the next steps.

In this example, it is **`arn:aws:iam::373699066757:role/ECSTaskWritetoLogs`**

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FtEWSZXZKzq25Cos4RIA6%2FScreenshot%202023-04-16%20at%2012.25.39%20PM.png?alt=media&#x26;token=c92440e9-3a95-4d19-8dd6-853255483574" alt=""><figcaption><p>Make note of ARN</p></figcaption></figure>

### (4) Create a Security Group for ECS

Go to **EC2** > **Security Groups** and click on "**Create security group**"

Depending on what region your Keeper tenant is hosted, you need to create inbound rules that allow https port 443. The list of IPs for each tenant location is on this page. In the example below, this is the US data center.

* We also recommend adding your workstation's external IP address for testing and troubleshooting.

Assign a name like "**MyAutomatorService"** and then click "Create".

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FaS9qtK3n5hroO9nM4JKH%2FScreenshot%202023-04-15%20at%208.45.19%20AM.png?alt=media&#x26;token=14b995cc-e412-4b44-990f-ed9e4ebaf477" alt=""><figcaption><p>Create ECS Security Group</p></figcaption></figure>

After saving the security group, edit the inbound rules again. This time, add HTTPS port 443 and select the security group in the drop-down. This will allow the load balancer to monitor health status and distribute traffic.

### (5) Create Security Group for EFS

We'll create another security group that controls NFS access to EFS from the cluster.

Go to **EC2** > **Security Groups** and click on "**Create security group**"

Set a name such as "**MyAutomatorEFS**".

Select Type of "**NFS**" and then select **Custom** and then the security group that was created in the prior step for the ECS cluster. Click "Create security group".

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FPRAUtvDXOiYJC4recatR%2FScreenshot%202023-04-16%20at%2011.56.02%20AM.png?alt=media&#x26;token=d59e5ca9-5f68-42d7-a5c7-9b504aaaa015" alt=""><figcaption></figcaption></figure>

Note the security group ID for the next step. In this case, it is `sgr-089fea5e4738f3898`

### (6) Create two Elastic File System volumes

At present, the Automator service needs access to two different folders. In this example setup, we are creating one volume to store the SSL certificate and SSL passphrase files. The second volume stores the property file for the Automator service. These 3 files are in your Keeper record.

Go to AWS > **Elastic File System** and click **Create file system**

Call it "**automator\_config"** and click **Create**

Again, go to **Elastic File System** and click **Create file system.** Call this one **automator\_settings** and click Create.

Note the File system IDs displayed. These IDs (e.g. fs-xxx) will be used in the ECS task definition.

After a minute, the 2 filesystems will be available. Click on each one and then select the "Network" tab then click on "Manage".

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2F1tuK6dgLSdsH7R3Nfgg9%2FScreenshot%202023-04-16%20at%2012.00.35%20PM.png?alt=media&#x26;token=8b70fcd5-c4e0-46fd-b3f8-29ada0c12c46" alt=""><figcaption><p>Manage the network security group on EFS</p></figcaption></figure>

Change the security group for each subnet to the one created in the above step (e.g. "MyAutomatorEFS") and click Save. Make this network change to both filesystems that were created.

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FizGzGOUd1Gj7hFBKdPEf%2FScreenshot%202023-04-16%20at%2012.02.23%20PM.png?alt=media&#x26;token=9e8047ba-c2f6-4392-9f63-3ae4f57633b3" alt=""><figcaption><p>Change the security group on EFS</p></figcaption></figure>

### (7) Create Elastic Container Service Cluster

Navigate to the Amazon Elastic Container Service.

Select "Create cluster" and assign the cluster name and VPC. In this example we are using the default "AWS Fargate (serverless)" infrastructure option.

* The Default namespace can be called "automator"
* The "Infrastructure" is set to AWS Fargate (serverless)
* Click Create

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FDrEB19cNlpEMWCRVRFso%2Fcreatecluster.JPG?alt=media&#x26;token=c8b5a65b-ed21-41b3-a0c3-e796b15160b2" alt=""><figcaption><p>Create ECS Cluster with AWS Fargate</p></figcaption></figure>

### (8) Create ECS Task Definition

In your favorite text editor, copy the below JSON task definition file and save it.

Make the following changes to the JSON file:

* Change the XXXCONFIGXXX value to a base64 config from Keeper Secrets Manager created in the beginning of this guide
* Change the 3 instances of "XXXXX" to the Record UID containing the SSL certificate, SSL certificate password and settings file in your vault shared folder which KSM is accessing.
* Change the two File system IDs (fs-XXX) to yours from the above steps
* Change the XXX for the role ID as specific to your AWS role
* Change the eu-west-1 value in two spots to the region of your ECS service

{% code overflow="wrap" %}

```
{
    "family": "automator",
    "containerDefinitions": [
        {
            "name": "init",
            "image": "keeper/keeper-secrets-manager-writer:latest",
            "cpu": 1024,
            "memory": 1024,
            "portMappings": [],
            "essential": false,
            "environment": [
                {
                    "name": "KSM_CONFIG",
                    "value": "XXXCONFIGXXX"
                },
                {
                    "name": "SECRETS",
                    "value": "XXXXX/file/ssl-certificate.pfx > file:/usr/mybin/config/ssl-certificate.pfx\nXXXXX/file/ssl-certificate-password.txt > file:/usr/mybin/config/ssl-certificate-password.txt\nXXXXX/file/keeper.properties > file:/usr/mybin/settings/keeper.properties"
                }
            ],
            "mountPoints": [
                {
                    "sourceVolume": "automatorconfig",
                    "containerPath": "/usr/mybin/config"
                },
                {
                    "sourceVolume": "automatorsettings",
                    "containerPath": "/usr/mybin/settings"
                }
            ],
            "volumesFrom": [],
            "logConfiguration": {
                "logDriver": "awslogs",
                "options": {
                    "awslogs-group": "automator-logs",
                    "awslogs-region": "eu-west-1",
                    "awslogs-stream-prefix": "container-1"
                }
            }
        },
        {
            "name": "main",
            "image": "keeper/automator:latest",
            "cpu": 1024,
            "memory": 4096,
            "portMappings": [
                {
                    "containerPort": 443,
                    "hostPort": 443,
                    "protocol": "tcp"
                }
            ],
            "essential": true,
            "environment": [],
            "mountPoints": [
                {
                    "sourceVolume": "automatorconfig",
                    "containerPath": "/usr/mybin/config"
                },
                {
                    "sourceVolume": "automatorsettings",
                    "containerPath": "/usr/mybin/settings"
                }
            ],
            "volumesFrom": [],
            "dependsOn": [
                {
                    "containerName": "init",
                    "condition": "SUCCESS"
                }
            ],
            "logConfiguration": {
                "logDriver": "awslogs",
                "options": {
                    "awslogs-group": "automator-logs",
                    "awslogs-region": "eu-west-1",
                    "awslogs-stream-prefix": "container-2"
                }
            }
        }
    ],
    "executionRoleArn": "arn:aws:iam::XXX:role/ECSTaskWritetoLogs",
    "networkMode": "awsvpc",
    "volumes": [
        {
            "name": "automatorconfig",
            "efsVolumeConfiguration": {
                "fileSystemId": "fs-XXX",
                "rootDirectory": "/",
                "transitEncryption": "ENABLED"
            }
        },
        {
            "name": "automatorsettings",
            "efsVolumeConfiguration": {
                "fileSystemId": "fs-XXX",
                "rootDirectory": "/",
                "transitEncryption": "ENABLED"
            }
        }
    ],
    "requiresCompatibilities": [
        "FARGATE"
    ],
    "cpu": "2048",
    "memory": "5120"
}
```

{% endcode %}

Next, go to Elastic Container Service > Task definitions > Create Task from JSON

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2Fm3lm796QfQhfGaZ2I709%2FScreenshot%202023-04-16%20at%2012.33.12%20PM.png?alt=media&#x26;token=0a0ffce9-e0db-4a7b-a2d8-9ed036862cf6" alt=""><figcaption><p>Create task definition with JSON</p></figcaption></figure>

Remove the existing JSON and copy-paste the contents of the JSON file above into the box, then click **Create**.

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FfCq1BTYSt3Gqn52dCGJm%2FScreenshot%202023-04-16%20at%208.06.14%20PM.png?alt=media&#x26;token=e08a8caa-d8a4-434d-b032-b5355b4794ec" alt=""><figcaption><p>Task definition</p></figcaption></figure>

This task definition can be modified according to your instance CPU/Memory requirements.

### (9) Upload SSL Cert to AWS Certificate Manager

In order for an application load balancer in AWS to serve requests for Automator, the SSL certificate must be managed by the AWS Certificate Manager.

Go to **AWS Certificate Manager** and Click on **Import**

On your workstation, we need to convert the SSL certificate (.pfx) file to a PEM-encoded certificate body, PEM-encoded private key and PEM-encoded certificate chain.

Since you already have the .pfx file, this can be done using the below openssl commands:

Download the ssl-certificate.pfx file and the certificate password locally to your workstation and enter the below commands:

* Generate the PEM-encoded certificate body

```
openssl pkcs12 -in ssl-certificate.pfx -out automator-certificate.pem -nodes
openssl x509 -in automator-certificate.pem -out certificate_body.crt
```

* Generate the PEM-encoded private key

```
openssl pkey -in automator-certificate.pem -out private_key.key
```

* Generate the PEM-encoded certificate chain

{% code overflow="wrap" %}

```
openssl crl2pkcs7 -nocrl -certfile automator-certificate.pem | openssl pkcs7 -print_certs -out certificate_chain.crt
```

{% endcode %}

Copy the contents of the 3 files into the screen, e.g.

```
cat certificate_body.crt | pbcopy
   (paste into Certificate body section)
   
cat private_key.key | pbcopy
   (paste into Certificate private key section)
   
cat certificate_chain.crt | pbcopy
   (paste into Certificate chain section)
```

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FYHZU2jh9oNJMZpNPUWn5%2FScreenshot%202023-04-16%20at%201.26.03%20PM.png?alt=media&#x26;token=dba7bcec-2952-4dff-bfe9-da19024ba1de" alt=""><figcaption><p>Import Certificate for Automator Service</p></figcaption></figure>

### (10) Create a Target Group

Go to EC2 > Target Groups and click Create target group

* Select "IP Addresses" as the target type
* Enter the Target group name of "**automatortargetgroup**" or whatever you prefer
* Select HTTPS Protocol with Port 443
* Select the VPC which contains the ECS cluster
* Select HTTP1
* Under Health checks, select the Health check protocol "**HTTPS**"
* Type **`/health`** as the Health check path
* Click Next
* Don't select any targets yet, just click **Create target group**

### (11) Create Application Load Balancer (ALB)

Go to **EC2** > **Load balancers** > **Create load balancer**

Select **Application Load Balancer** > **Create**

* Assign name such as "**automatornalb**" or whatever you prefer
* Scheme is "Internet-facing"
* IP address type: IPv4
* In the Network Mapping section, select the VPC and the subnets which will host the ECS service.
* In the Security groups, select "**MyAutomatorService**" as created in Step 4.
* In the Listeners and routing section, select HTTPS port 443 and in the target group select the Target group as created in the prior step (**automatortargetgroup**).
* In the Secure listener settings, select the SSL certificate "from ACM" that was uploaded to the AWS Certificate Manager in Step 9.
* Click **Create load balancer**

### (12) Create ECS Service

Go to Elastic Container Service > Task definitions > Select the task created in Step 8.

From this Task definition, click on Deploy > Create Service

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FELJzPJLTxOBdLMi2ChZE%2FScreenshot%202023-04-16%20at%2012.35.25%20PM.png?alt=media&#x26;token=baa672ef-7e01-43e3-b167-a389a68a1fac" alt=""><figcaption><p>Create service</p></figcaption></figure>

* Select Existing cluster of "**automator**"
* Assign Service name of "**automatorservice**" or whatever name you prefer
* **Important:** For the number of Desired tasks, set this to 1 for right now. After configuration, we will increase to the number of tasks you would like to have running.
* Under Networking, select the VPC, subnets and replace the existing security group with the ECS security group created in Step 4. In this case, it is called "**MyAutomatorService**".
* For **Public IP,** turn this **ON**.
* Under Load balancing, select Load balancer type "**Application Load Balancer**"
* Use an **existing** load balancer and select "**automatoralb**" created in Step 11.
* Use an **existing** listener, and select the 443:HTTPS listener
* Use an **existing** target group, and select the Target Group from Step 10
* Click **Create**

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FYgwtq7WJe3lHDJ6WJFo0%2FScreenshot%202023-04-16%20at%201.45.11%20PM.png?alt=media&#x26;token=41356351-0981-4562-bb17-66e48e4fc35e" alt=""><figcaption><p>Environment Section of ECS Service</p></figcaption></figure>

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FfqBYsEiSjifcMgi3NsPW%2FScreenshot%202023-04-16%20at%201.45.48%20PM.png?alt=media&#x26;token=6942c7ac-770e-4f44-add9-8cc936737ee1" alt=""><figcaption><p>Deployment configuration</p></figcaption></figure>

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FsziDc795dTQeJ3qgUlFz%2FScreenshot%202023-04-16%20at%201.46.33%20PM.png?alt=media&#x26;token=9aba8640-a968-456b-b313-aaa6b4a50191" alt=""><figcaption><p>Networking section of ECS Service</p></figcaption></figure>

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FYNYFX4g7IVy9BjZ3mT0Q%2FScreenshot%202023-04-16%20at%201.47.02%20PM.png?alt=media&#x26;token=5c6d52d6-6c37-4f1a-8fa1-dca37b16f13c" alt=""><figcaption></figcaption></figure>

After a few minutes, the service should start up.

### (13) Update DNS

Assuming that the DNS name is hosted and managed by Route53:

Go to **Route53** > **Create** or Edit record

* Create an A-record
* Set as "Alias"
* Route traffic to "Alias to Application and Classic Load Balancer"
* Select AWS Region
* Select the "automatoralb" Application Load Balancer
* Select "Simple Routing"
* Select "Save"

The next step is to configure Automator using Keeper Commander while only having one task running.

### **(14) Install Keeper Commander**

At this point, the service is running but it is not able to communicate with Keeper yet.

On your workstation, server or any computer, install the Keeper Commander CLI. This is just used for initial setup. The installation instructions including binary installers are here:\
[**Installing Keeper Commander**](https://docs.keeper.io/keeperpam/commander-cli/commander-installation-setup)\
\
After Commander is installed, you can type `keeper shell` to open the session, then login using the `login` command. In order to set up Automator, you must login as a Keeper Administrator, or an Admin with the ability to manage the SSO node.

```
$ keeper shell

My Vault> login admin@company.com
.
.
My Vault>
```

### **(15) Initialize with Commander**

Login to [Keeper Commander](https://docs.keeper.io/keeperpam/commander-cli/overview) and activate the Automator using a series of commands, starting with `automator create`

```
My Vault> automator create --name="My Automator" --node="Azure Cloud"
```

The Node Name (in this case "Azure Cloud") comes from the Admin Console UI as seen below.

![Automator Create](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MjGtCqu00Eduh1ZVB0V%2F-MjGwSk57QheWM55KqUd%2FScreen%20Shot%202021-09-10%20at%203.59.58%20PM.png?alt=media\&token=732b0e49-b10f-4718-a78e-f48af15ef50c)

The output of the command will display the Automator settings, including metadata from the identity provider.

```
                    Automator ID: 1477468749950
                            Name: My Automator
                             URL: 
                         Enabled: No
                     Initialized: No
                          Skills: Device Approval
```

Run the "automator edit" command as displayed below, which sets the URL and also sets up the skills (`team`, `team_for_user` and `device`).

{% code overflow="wrap" %}

```
automator edit --url https://<application URL> --skill=team --skill=team_for_user --skill=device "My Automator"
```

{% endcode %}

Next we exchange keys: The enterprise private key encrypted with the Automator public key is provided to Automator:

```
automator setup "My Automator"
```

Initialize the Automator with the new configuration

```
automator init "My Automator"
```

Enable the service

```
automator enable "My Automator"
```

At this point, the configuration is complete.

For automated health checks, you can use the below URL:

https\://\<server>/health

Example `curl` command:

```
$ curl https://automator.lurey.com/health
OK
```

In this example setup, the load balancer will be sending `health` checks to the target instances.

### (16) Testing the User Experience

Now that Keeper Automator is deployed with a single task running, you can test the end-user experience. No prompts for approval will be required after the user authenticates with the SSO identity provider.

The easiest way to test is to open an incognito mode window to the Keeper Web Vault and login with SSO Cloud. You will not be prompted for device approval.

![Vault Login](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MjHF255ECP0j30Bea03%2F-MjHFJmk7eb90I9bzgTh%2FScreen%20Shot%202021-09-10%20at%205.17.42%20PM.png?alt=media\&token=3cd0160f-945f-4c99-9e54-1dab79e76365)

![SSO Login](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MjHF255ECP0j30Bea03%2F-MjHFOMTOlVXIBtHQPI-%2FScreen%20Shot%202021-09-10%20at%205.18.15%20PM.png?alt=media\&token=f2080eaa-5aa3-443d-a315-8dc4ae03cccc)

![Automated Approval](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MjHF255ECP0j30Bea03%2F-MjHFuUwqi7o2N3UeIaw%2FScreen%20Shot%202021-09-10%20at%205.30.15%20PM.png?alt=media\&token=2ab8c7db-fcf4-40b7-8fce-5a5e278c44f9)

![Vault Decrypted](https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MB_i6vKdtG6Z2n6zWgJ%2F-MjHF255ECP0j30Bea03%2F-MjHGEmuzfD60LH3rUvO%2FScreen%20Shot%202021-09-10%20at%205.32.12%20PM.png?alt=media\&token=0c268937-ae82-49e4-b198-851ddf89e477)

Assuming that the approval worked, you can now increase the number of tasks running.

### (17) Update Task Definition

From the ECS screen, open the automator service and click "Update Service". Then set the number of tasks that you would like to have running.

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FkYXvfprlZ9ONfymkVbIL%2FScreenshot%202023-07-12%20at%2012.22.23%20PM.jpg?alt=media&#x26;token=7dbcacf5-1320-4cd2-b7cf-a2f77e0a7ffd" alt=""><figcaption><p>Update service</p></figcaption></figure>

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FHkm6tdcsQK0FAiBcmHJC%2FScreenshot%202023-07-12%20at%2012.22.32%20PM.jpg?alt=media&#x26;token=936d2ce9-931b-4859-a90c-9ddde9734d4f" alt=""><figcaption><p>Set the desired tasks</p></figcaption></figure>

### Logging and Monitoring

The Automator logs can be searched and monitored in the "Logs" tab of the ECS service, or in CloudWatch.

<figure><img src="https://2503956294-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MB_i6vKdtG6Z2n6zWgJ%2Fuploads%2FEAdPAidSx00B11SYTaO9%2FScreenshot%202023-07-12%20at%2012.42.07%20PM.jpg?alt=media&#x26;token=676b59c7-e5d2-43cd-9a1c-523e2dbf98e0" alt=""><figcaption><p>Logging and Monitoring</p></figcaption></figure>
