Skip to content

Register a S3 bucket as a snapshot repository for an AWS Elasticsearch instance setup inside a VPC.

License

Notifications You must be signed in to change notification settings

chuntley/aws-es-s3-snapshot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS ElasticSearch S3 Snapshot

Register a S3 bucket as a snapshot repository for an AWS Elasticsearch instance setup inside a VPC.

Getting Started

Before running this package, you will need to setup a new ARN to allow ElasticSearch to use S3 as a snapshot repository.

AWS Setup

Follow the AWS Elasticsearch S3 Snapshot instructions for creating an IAM Role and Policy. Ignore the rest starting at "Registering a Manual Snapshot Directory".

Installing

yarn

or

npm i

Registering the snapshot

You will first need to create a SSH tunnel to your Elasticsearch instance using a bastion (or jumpbox) server. For example:

ssh -N -L localhost:9200:vpc-xxxx.us-west-2.es.amazonaws.com:443 [email protected]

To run this script and register the snapshot repository, you will need to add some environmental variables. Since this will only need to be run once, it might be easier to pass them inline.

ES_REGION=xxx S3_REGION=xxx BUCKET_NAME=xxx ROLE_ARN=arn:xxx ACCESS_KEY=xxx SECRET_KEY=xxx SNAPSHOT_NAME=xxx LOCAL_ES_PORT=9200 node index.js

Or if you have exported the environment variables you can simply run this with:

node index.js

Environment Variables

All are required.

Variable Description
ES_REGION Elasticsearch region
S3_REGION S3 Bucket region
BUCKET_NAME S3 Bucket name
BUCKET_PATH Path to backup location, no leading slash (optional)
ROLE_ARN The ARN from the created IAM role
ACCESS_KEY Your AWS access key
SECRET_KEY Your AWS secret key
SNAPSHOT_NAME The snapshot name
READ_ONLY Make read only, defaults to false (optional)
LOCAL_ES_PORT The local port your tunneled ES instance

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

Register a S3 bucket as a snapshot repository for an AWS Elasticsearch instance setup inside a VPC.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published