Skip to content

OpenSearch Auto Scaling CLI Guide

The search-hq opensearch-auto-scaling command-line interface (CLI) allows you to manage and operate the OpenSearch Auto Scaling service. This includes downloading configurations, deploying the service and destroying the service.

Getting Started

To get started with the search-hq CLI, run the following command to see an overview of available options and commands:

search-hq opensearch-auto-scaling --help

This command will display a summary of the CLI usage, including available commands and options:

Usage: search-hq opensearch-auto-scaling [OPTIONS] COMMAND [ARGS]...

  Operate OpenSearch Auto Scaling service.

Options:
  --help  Show this message and exit.

Commands:
  deploy         Deploy OpenSearch Auto Scaling service.
  destroy        Destroy OpenSearch Auto Scaling service.
  download-conf  Download configurations used by OpenSearch Auto Scaling service.

Download Configurations

The download-conf command downloads the configurations used by the OpenSearch Auto Scaling service from Amazon S3. When you deploy the OpenSearch Auto Scaling service, the configurations are automatically uploaded to Amazon S3. Therefore, you can use this command to download the configurations for comparison. You need to pass the parameter dest_folder to specify the destination folder where the configurations will be saved.

Command:

search-hq opensearch-auto-scaling download-conf \
--dest_folder <DEST_FOLDER>
Option Type Required Description
dest_folder String Required The destination folder where the configurations will be saved.

Example Usage:

search-hq opensearch-auto-scaling download-conf \
--dest_folder dest_conf_folder

Deploy OpenSearch Auto Scaling service

The deploy command deploys the OpenSearch Auto Scaling service. This command uses configurations from your project settings to ensure that the service is deployed correctly and synchronized with your AWS environment.

Command:

search-hq opensearch-auto-scaling deploy  \
--auto_approve <AUTO_APPROVE>
Option Type Required Description
auto_approve Boolean Optional Automatically approve all prompts during deployment without manual confirmation. Default is True.

Example Usage:

search-hq opensearch-auto-scaling deploy  \
--auto_approve True

List CloudFormation Stack Resources

The search-hq resources command lists the resources for CloudFormation stacks. This is useful for reviewing the components that have been deployed, including infrastructure, services, and other resources managed by the application.

To list resources for all CloudFormation stacks, use:

search-hq resources

To list resources for particular CloudFormation stacks, use:

search-hq resources <STACK_NAMES>

Replace <STACK_NAMES> with the names of the stacks you want to query.

Display CloudFormation Stack Statuses

Use the search-hq status command to display the statuses of CloudFormation stacks, including current status, creation time, and last updated time.

To list the statuses of all CloudFormation stacks, use:

search-hq status

To list the statuses of specific CloudFormation stacks, use:

search-hq status <STACK_NAMES>

Replace <STACK_NAMES> with the names of the stacks you want to query.

Destroy OpenSearch Auto Scaling service

The destroy command is used to remove the OpenSearch Auto Scaling service and associated resources. This is necessary when you need to clean up resources or decommission the service from your AWS environment. Properly managing the lifecycle of your services is crucial for maintaining an organized and cost-efficient AWS environment.

Command:

search-hq opensearch-auto-scaling destroy  \
--auto_approve <AUTO_APPROVE>  \
--destroy_infra <DESTROY_INFRA>
Option Type Required Description
auto_approve Boolean Optional Automatically approve all prompts during destruction without manual confirmation. Default is True.
destroy_infra Boolean Required Destroy the application infrastructure if needed.

Example Usage:

search-hq opensearch-auto-scaling destroy  \
--auto_approve True  \
--destroy_infra False

Remove Associated Resources

By default, the destroy command will retain the Amazon S3 bucket and AWS Systems Manager Parameter Store associated with your search-hq deployment. You can choose to manually delete these resources if needed.

  • Remove Objects from Amazon S3 Bucket: To delete the entire Amazon S3 bucket associated with your search-hq deployment, use the following command. This will remove the entire bucket and all objects within it:

    python -m operation.cli.s3 delete_bucket
    

    If you only need to delete a single object from the Amazon S3 bucket, use:

    python -m operation.cli.s3 delete_object --key <S3_OBJECT_KEY>
    

    Replace <S3_OBJECT_KEY> with the key of the object you want to delete from the Amazon S3 bucket.

  • Remove Parameters from AWS Systems Manager Parameter Store: To delete all parameters associated with your search-hq deployment from AWS Systems Manager Parameter Store, use:

    python -m operation.cli.ssm delete_ssm_parameters
    

    If you only need to delete a single parameter, use:

    python -m operation.cli.ssm delete_ssm_parameter --parameter_name <PARAMETER_NAME>
    

    Replace <PARAMETER_NAME> with the name of the parameter you want to delete from the AWS Systems Manager Parameter Store.