Step 1: Bootstrap the infrastructure and AWS Glue jobs
In this step, you use the keyspaces-bulk-cli CLI to create and configure all the AWS
resources required for the automated data export of an Amazon Keyspaces table to an Amazon S3
bucket using AWS Glue. The bootstrap command performs all setup tasks in a single step.
The bootstrap command automates the following tasks.
Creates an Amazon S3 bucket and an IAM service role using CloudFormation.
Downloads the Apache Spark Cassandra Connector
, the SigV4 Authentication plugin , and the Apache Spark Extensions . Downloads and builds the Keyspaces Retry Policy
helper using Maven. Uploads all JAR files and the
keyspaces-application.confconfiguration file to the Amazon S3 bucket.Deploys three AWS Glue jobs: export (export a table to Amazon S3), import (import data from Amazon S3 into a table), and count (count rows in a table).
Saves the stack configuration to a local
.keyspaces-bulk-cli.jsonfile for use by subsequent commands.
To bootstrap the infrastructure and AWS Glue jobs
Clone the files from the aws-glue
repository on GitHub to your local machine. $git clone https://github.com/aws-samples/amazon-keyspaces-examples.git$cd amazon-keyspaces-examples/scala/datastax-v4/aws-glue-
Run the
bootstrapcommand. The following example uses the default stack nameaksglueand specifies the keyspace and table as defaults for the deployed jobs. You can override these values when running individual commands such asexport,import, orcount.$./keyspaces-bulk-cli bootstrap --stackaksglue--keyspacecatalog--tablebook_awardsThe following table describes the optional parameters you can pass to customize the bootstrap.
Option Default Description --stackaksglueCloudFormation stack name prefix --bucketAuto-generated from stack and account Amazon S3 bucket for artifacts --role-nameAuto-generated from stack IAM service role name --keyspacemykeyspaceDefault keyspace for deployed jobs --tablemytableDefault table for deployed jobs --s3-uris3://{bucket}/exportDefault Amazon S3 path for exported data --formatparquetDefault data format --regionFrom AWS config AWS Region --profileFrom AWS config AWS named profile To confirm that the Amazon S3 bucket created by bootstrap exists, you can use the following AWS CLI command. Replace
YOURACCOUNTIDwith your AWS account ID.$aws s3 ls s3://amazon-keyspaces-bulk-cli-aksglue-YOURACCOUNTIDThe output of the command looks similar to the following:
PRE conf/ PRE jars/ PRE scripts/To confirm that the AWS Glue export job was deployed, you can use the following command.
$aws glue list-jobsThe output lists the deployed jobs:
{ "JobNames": [ "AmazonKeyspacesExportToS3-aksglue", "AmazonKeyspacesImportFromS3-aksglue", "AmazonKeyspacesCount-aksglue" ] }
If the CloudFormation stack process fails, you can review the detailed error information about the failed stack in the CloudFormation console.
To retry, delete the failed stack using aws cloudformation delete-stack --stack-name ,
fix the underlying issue, and run the bootstrap command again. The bootstrap command is idempotent and skips resources that already exist.aksglue
After the bootstrap completes and all resources are created, proceed to Step 2: Run the export job.