

# Uninstall the solution
Uninstall the solution

You can uninstall the MCS solution from the AWS Management Console or by using the AWS Command Line Interface (AWS CLI). You must manually delete the modules and some of the core resources created by this solution. AWS Solutions do not automatically delete dependents of modules and storage backup resources in case you have stored data to retain. As such, see the following information on how to delete S3 buckets, CloudWatch logs, EC2 AMIs (from Leostream Broker module) and SSM parameters (from Leostream Broker module).

**Important**  
Before uninstalling the solution, ensure that all modules and all spoke Regions have been disabled, and any Third-Party modules registered to the solution have been de-registered.

## Using the AWS Management Console


1. Sign in to the [CloudFormation console](https://console.aws.amazon.com/cloudformation/home/).

1. On the **Stacks** page, select this solution’s installation stack.

1. Choose **Delete**.

## Using AWS Command Line Interface


Determine whether the AWS Command Line Interface (AWS CLI) is available in your environment. For installation instructions, see [What Is the AWS Command Line Interface](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html) in the *AWS CLI User Guide*. After confirming that the AWS CLI is available, run the following command.

```
$ aws cloudformation delete-stack --stack-name <installation-stack-name>
```

# Manual delete retained resources


After deleting the core stack, see the following sections for how to delete remaining resources.

## Deleting the Amazon S3 buckets


This solution is configured to retain the solution-created Amazon S3 bucket (for deploying in an opt-in Region) if you decide to delete the AWS CloudFormation stack to prevent accidental data loss. After uninstalling the solution, you can manually delete this S3 bucket if you do not need to retain the data. Follow these steps to delete the Amazon S3 bucket.

1. Sign in to the [Amazon S3 console](https://console.aws.amazon.com/s3/home).

1. Choose **Buckets** from the left navigation pane.

1. Locate the S3 buckets that begin with  *<stack-name>* .

1. Select the S3 bucket and choose **Delete**.

To delete the S3 bucket using AWS CLI, run the following command:

```
$ aws s3 rb s3://<bucket-name> --force
```

## Deleting the CloudWatch Logs


This solution retains the CloudWatch Logs if you decide to delete the AWS CloudFormation stack to prevent against accidental data loss. After uninstalling the solution, you can manually delete the logs if you do not need to retain the data. Follow these steps to delete the CloudWatch Logs.

1. Sign in to the [Amazon CloudWatch console](https://console.aws.amazon.com/cloudwatch/home).

1. Choose **Log Groups** from the left navigation pane.

1. Locate the log groups created by the solution.

1. Select one of the log groups.

1. Choose **Actions** and then choose **Delete**.

Repeat the steps until you have deleted all the solution log groups.

## Deleting the Amazon EC2 AMIs


This solution is configured to retain the Amazon EC2 AMIs if you enable and then disable the Leostream Broker stack. After uninstalling the solution, you can manually delete the Amazon EC2 AMIs if you do not need to retain the data. Follow these steps:

1. Sign in to the [Amazon EC2 console](https://console.aws.amazon.com/ec2/home).

1. Choose **AMIs** from the left navigation pane under **Images**.

1. Select the **AMIs** you wish to remove, and choose **Actions → Deregister AMI**.

To delete the DynamoDB tables using AWS CLI, run the following command:

```
$ aws ec2 deregister-image --image-id <image-id>
```

## Deleting the SSM Parameters


This solution is configured to retain Systems Manager Parameters if you enable and then disable the Leostream Broker stack. After uninstalling the solution, you can manually delete the Systems Manager Parameters if you do not need to retain the data. Follow these steps:

1. Sign in to the [Systems Manager console](https://console.aws.amazon.com/systems-manager/).

1. Choose **Parameter Store** from the left navigation pane.

1. Select the **Parameters** you wish to remove, and choose **Delete**.

To delete the Parameters tables using AWS CLI, run the following command:

```
$ aws ssm delete-parameter --name <parameter-name>
```

## Deleting the FSx for Windows File Server Backups


This solution retains the FSx for Windows File Server backups if you decide to disable the AWS FSx for Windows File Server module to prevent against accidental data loss. After uninstalling the solution, you can manually delete the backups if you do not need to retain the data. Follow these steps to delete the FSx Backups.

1. Sign in to the [Amazon FSx console](https://console.aws.amazon.com/fsx).

1. Choose **Backups** from the left navigation pane.

1. Select the backup created by the Amazon FSx for Windows File Server file system when it was disabled.

1. Choose **Actions**, and then choose **Delete Backup**.