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-eni

down
  • #!/usr/bin/env bash
  • #
  • # Search for an available Elastic Network Interface (ENI) and attach it. 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 ENI.
  • #
  • # This script searches for an available Elastic Network Interface (ENI) that the EC2 Instance running this script can
  • # attach so that it will be reachable at a second private IP address. If no available ENI is found, the EC2 Instance
  • # will terminate itself so that a new EC2 Instance can spawn, hopefully in a subnet in which there is an available ENI.
  • #
  • set -e
  • readonly ERR_NO_ENI_FOUND="__NO_ENI_FOUND__"
  • function print_usage {
  • echo
  • echo "Usage: attach-eni [OPTIONS]"
  • echo
  • echo "Search for an Elastic Network Interface (ENI) that is available, located in the same Subnet as this EC2 Instance,"
  • echo "and whose tags match the specified values. If none is found, terminate this EC2 Instance in the hopes that another"
  • echo "EC2 Instance will spawn in a Subnet that does have an attachable ENI."
  • echo
  • echo "Required Arguments:"

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?