# Updating a connector in AWS

Periodically, you may need to update your AWS connector to help maintain functionality, performance, and security.

This article explains how to update a connector through the AWS CLI and redeploy the CloudFormation stack with the latest connector template.

***

### Prerequisites

<table><thead><tr><th width="209">Item</th><th>Description</th></tr></thead><tbody><tr><td><strong>AWS Stack Name</strong></td><td><p>In AWS CloudFormation, name of a collection of AWS resources managed as a single unit<br><br>Use the following steps to retrieve the stack name:</p><ol><li>Go to the <a href="https://console.aws.amazon.com/cloudformation/home/stacks"><strong>Stacks</strong></a> page.</li><li>Under the <strong>Stack name</strong> column, copy the stack name.</li></ol><p><img src="https://1094436629-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fv6MBfUGvblSdAz31yJXm%2Fuploads%2Fgit-blob-a9bc4c8d06fe5ddba80dac6a35f56b9be2ac8540%2Fimage%20(2)%20(1)%20(1)%20(1)%20(1)%20(1).png?alt=media" alt=""><br></p></td></tr><tr><td><strong>AWS Command Line Interface (AWS CLI)</strong></td><td><a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html">Open-source tool</a> enabling interaction with AWS services using your command-line shell</td></tr><tr><td><strong>AWS Permissions</strong></td><td><a href="https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AdministratorAccess.html">Permissions</a> enabling the ability to update the stack via AWS CLI</td></tr></tbody></table>

***

### Update a connector

{% hint style="warning" %}
If you're updating an Organization-level connector, follow these steps for connectors installed in the Management account.

If updating a connector with [assumable permissions to the Management account](https://docs.apono.io/docs/aws-environment/apono-connector-for-aws#connector-with-assumable-permissions-to-the-aws-management-account), reach out to your Apono Customer Success representative.
{% endhint %}

Follow these steps to update a connector:

1. Copy the following Account level or Organization level AWS update script. Be sure to replace `AWS_STACK_NAME` with your AWS stack name.

{% tabs %}
{% tab title="Account Level" %}
{% code overflow="wrap" %}

```sh
aws cloudformation update-stack --stack-name AWS_STACK_NAME \
    --template-url https://apono-public.s3.amazonaws.com/cloudformation/aws_integration_with_connector_template.yml \
    --parameters ParameterKey=AponoConnectorId,UsePreviousValue=true \
                 ParameterKey=AponoConnectorToken,UsePreviousValue=true \
                 ParameterKey=ExternalID,UsePreviousValue=true \
                 ParameterKey=SubnetIDs,UsePreviousValue=true \
                 ParameterKey=VpcId,UsePreviousValue=true \
                 ParameterKey=S3AWSLogsScanning,UsePreviousValue=true \
                 ParameterKey=S3AWSLogsScanning,ParameterValue=Enabled \
    --capabilities CAPABILITY_NAMED_IAM
```

{% endcode %}
{% endtab %}

{% tab title="Organizational Level - Connector in a Management Account" %}

<pre class="language-sh" data-overflow="wrap"><code class="lang-sh"><strong>aws cloudformation update-stack --stack-name AWS_STACK_NAME --template-url https://apono-public.s3.amazonaws.com/cloudformation/aws_organization_integration_template.yml \
</strong>    --parameters ParameterKey=AponoConnectorId,UsePreviousValue=true \
                 ParameterKey=AponoConnectorToken,UsePreviousValue=true \
                 ParameterKey=AssignPublicIp,UsePreviousValue=true \
                 ParameterKey=ExternalID,UsePreviousValue=true \
                 ParameterKey=OrganizationalUnitId,UsePreviousValue=true \
                 ParameterKey=SubnetIDs,UsePreviousValue=true \
                 ParameterKey=VpcId,UsePreviousValue=true \
                 ParameterKey=S3AWSLogsScanning,UsePreviousValue=true \
                 ParameterKey=S3AWSLogsScanning,ParameterValue=Enabled \
    --capabilities CAPABILITY_NAMED_IAM
</code></pre>

{% endtab %}
{% endtabs %}

{% hint style="info" %}
If you have not defined a default region and [default profile](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html), you must specify the region and profile in the script:

```shell
--profile AWS_PROFILE --region AWS_SERVER_REGION
```

Be sure to replace `AWS_PROFILE` and `AWS_SERVER_REGION` with your profile and region values.
{% endhint %}

2. At your AWS CLI prompt, enter the updated script from the previous step to initiate the update. The AWS CLI will return an object containing the `StackId`.
3. In CloudFormation, on the **Stack Info** tab, confirm that the update has completed:
   1. Go to the [Stacks](https://console.aws.amazon.com/cloudformation/home/stacks) page. A list of the stacks in the account are displayed.
   2. Under the **Stack name** column, click the stack name.
   3. On the **Stack info** tab, check the **Status**.

***

### Troubleshooting

This section details common errors that can occur during the updating process. If an error occurs that is not listed below, please contact your Apono representative.

<details>

<summary><strong>An error occurred (ValidationError) when calling the UpdateStack operation: Stack [stack name] does not exist.</strong></summary>

This occurs when the incorrect stack name has been included in the update script.

Use the following steps to correct this error:

1. Locate and copy the stack name under the **Stack name** column of the [**Stacks**](https://console.aws.amazon.com/cloudformation/home/stacks) page.
2. Repeat the [update process](#update-a-connector).

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.apono.io/docs/aws-environment/apono-connector-for-aws/updating-a-connector-in-aws.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
