Browse the Repo

file-type-icon.circleci
file-type-icon_docs
file-type-iconexamples
file-type-iconmodules
file-type-iconbackup-mongodb
file-type-iconinit-mongodb
file-type-iconinstall-mongodb
file-type-iconmongodb-backup
file-type-iconmongodb-cluster
file-type-iconrun-mongodb
file-type-iconsetup-ec2-instance
file-type-iconbin
file-type-iconattach-ebs-volume
file-type-iconattach-eni
file-type-iconREADME.md
file-type-iconinstall.sh
file-type-icontest
file-type-icon.gitignore
file-type-iconCODEOWNERS
file-type-iconLICENSE.txt
file-type-iconREADME.md

Browse the Repo

file-type-icon.circleci
file-type-icon_docs
file-type-iconexamples
file-type-iconmodules
file-type-iconbackup-mongodb
file-type-iconinit-mongodb
file-type-iconinstall-mongodb
file-type-iconmongodb-backup
file-type-iconmongodb-cluster
file-type-iconrun-mongodb
file-type-iconsetup-ec2-instance
file-type-iconbin
file-type-iconattach-ebs-volume
file-type-iconattach-eni
file-type-iconREADME.md
file-type-iconinstall.sh
file-type-icontest
file-type-icon.gitignore
file-type-iconCODEOWNERS
file-type-iconLICENSE.txt
file-type-iconREADME.md
MongoDB

MongoDB

Deploy a MongoDB cluster. Supports replica sets, sharding, automated bootstrapping, backup, recovery, and OS optimizations.

Code Preview

Preview the Code

mobile file icon

attach-ebs-volume

down
  • #!/usr/bin/env bash
  • #
  • # Search for an available EBS Volume to attach. If none is found, terminate this EC2 Instance.
  • #
  • # Why terminate? We assume this EC2 Instance is run within an Auto Scaling Group and we hope that a new EC2 Instance
  • # will spawn in an Availability Zones that does have an available EBS Volume.
  • #
  • # This script searches for an EBS Volume matching the --ebs-tag-name and --ebs-tag-value parameters that is both available
  • # and in the same Availability Zone on the EC2 Instance on which this script runs. If no such EBS Volume is found, it
  • # will create the appropriate EBS Volume. It will then mount the found or created EBS Volume to the specified mount path.
  • #
  • set -e
  • readonly ERR_NO_EBS_VOLUME_FOUND="__NO_EBS_VOLUME_FOUND__"
  • readonly DEFAULT_EBS_VOLUME_TYPE="gp2"
  • readonly DEFAULT_EBS_VOLUME_FILE_SYSTEM="ext4"
  • readonly DEFAULT_EBS_VOLUME_MOUNT_OPTIONS="defaults,nofail"
  • function print_usage {
  • echo
  • echo "Usage: attach-ebs-volume [OPTIONS]"
  • echo
  • echo "Search for an available EBS Volume to attach. If none is found, create a new one and attach it."

Questions? Ask away.

We're here to talk about our services, answer any questions, give advice, or just to chat.

Ready to hand off the Gruntwork?