Skip to main content

Copy data from Aiven for OpenSearch® to AWS S3 using elasticsearch-dump

Backup your OpenSearch® data into an AWS S3 bucket using the elasticsearch-dump tool, copying one index at a time with its elasticdump command.

Prerequisites

  • elasticsearch-dump tool installed
  • Aiven for OpenSearch cluster as the input
  • AWS S3 bucket as the output

Collect the following information about your Aiven for OpenSearch cluster and your AWS service:

Aiven for OpenSearch:

  • SERVICE_URI: OpenSearch service URI, see it in the Aiven dashboard.
  • INPUT_INDEX_NAME: the index that you aim to copy from your input source.

AWS S3:

  • AWS credentials (ACCESS_KEY_ID and SECRET_ACCESS_KEY).
  • S3 file path. This includes bucket name and file name, for for example, s3://${BUCKET_NAME}/${FILE_NAME}.json

For more information about AWS credentials, see the AWS documentation.

Export OpenSearch index data to S3

Use elasticsearch-dump command to copy the data from your Aiven for OpenSearch cluster to your AWS S3 bucket. Use your Aiven for OpenSearch SERVICE_URI for the input. For the output, choose an AWS S3 file path including the file name that you want for your document.

elasticdump \
--s3AccessKeyId "${ACCESS_KEY_ID}" \
--s3SecretAccessKey "${SECRET_ACCESS_KEY}" \
--input=SERVICE_URI/INPUT_INDEX_NAME --output "s3://${BUCKET_NAME}/${FILE_NAME}.json"