-
Notifications
You must be signed in to change notification settings - Fork 30
Load Sample Data into Source Cluster
This guide demonstrates how to quickly load test data into an Elasticsearch or OpenSearch source cluster using AWS Glue and the AWS Open Dataset library. We'll walk through indexing Bitcoin transaction data on the source cluster. For more details, refer to the official AWS documentation on setting up Glue connections to OpenSearch ↗.
Create your source cluster using the method of your choice, keeping in mind the following requirements:
- We will use basic authentication (username/password) for access control. In this example, we are using Elasticsearch 7.10, but earlier versions of Elasticsearch and OpenSearch 1.X and 2.X are also supported.
- The source cluster must be in a VPC you control and have access to, enabling AWS Glue to send data to it.
Create a secret in AWS Secrets Manager that provides AWS Glue with access to the source cluster’s basic authentication credentials:
- Navigate to the AWS Secrets Manager Console.
- Create a generic secret. Name it as you prefer and configure replication/rotation as needed.
Key fields:
-
opensearch.net.http.auth.user
: The username for accessing the source cluster. -
opensearch.net.http.auth.pass
: The password for accessing the source cluster.
Example Access Secrets
Create an IAM Role that grants AWS Glue the necessary permissions:
- Navigate to the IAM Console and create a new IAM Role.
- Use the following trust policy to allow the AWS Glue service to assume the role:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "glue.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
-
Attach the following permission sets:
AWSGlueServiceRole
AmazonS3ReadOnlyAccess
-
Grant the role access to the secret created in step 2 by adding an inline policy like this:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "secretsmanager:GetSecretValue",
"Resource": "arn:aws:secretsmanager:us-east-1:XXXXXXXXXXXX:secret:migration-assistant-source-cluster-creds-YDtnmx"
}
]
}
Create a Glue Connection to provide AWS Glue with access to the source cluster:
- Navigate to the AWS Glue Console.
- Create a new connection of the Amazon OpenSearch Service type.
- Fill in your source cluster’s details (including VPC, subnet, and security group) and use the secret created earlier.
Example Glue Connection Configuration
The sample dataset we'll use is the AWS Public Blockchain dataset ↗, which is available for free. More information can be found in this blog post ↗, and you can browse its contents in S3 here ↗.
The Bitcoin transaction data we'll load into our source cluster is located at the S3 URI: s3://aws-public-blockchain/v1.0/btc/transactions/
.
Now, create a Glue Job in the AWS Glue Console using the connection you created earlier.
- Set the S3 URI to
s3://aws-public-blockchain/v1.0/btc/transactions
. - Enable recursive reading of the bucket's contents.
- The data format is Parquet.
Example Glue Connection
- Select the AWS Glue Connection you created.
- Specify the index name where the Bitcoin transaction data will be stored.
Example Data Sink
This is an optional step. By default, the Glue Job creates a single-shard index. Since the dataset is approximately 1 TB in size, it's recommended to pre-create the index with multiple shards. Follow this example to create an index with 40 shards:
curl -u <your username>:<your password> -X PUT "http://<your source cluster domain>:9200/bitcoin-data" -H 'Content-Type: application/json' -d'
{
"settings": {
"number_of_shards": 40,
"number_of_replicas": 1
}
}
'
You can also adjust any additional index settings at this time.
Once the Glue source and target are configured, run the job in the AWS Console by clicking the Run button. You can monitor the job’s progress under the Runs tab in the console.
Encountering a compatibility issue or missing feature?
- Search existing issues to see if it’s already reported. If it is, feel free to upvote and comment.
- Can’t find it? Create a new issue to let us know.
- Migration Assistant Overview
- Is Migration Assistant Right for You?
- Existing Data Migration - Quick Start Guide
- A. Snapshot Creation Verification
- B. Client Traffic Switchover Verification
- C. Traffic Capture Verification
- D. System Reset Before Migration