Skip to content

Instantly share code, notes, and snippets.

@mrlynn
Last active August 10, 2018 01:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrlynn/ebea9cdbfc34aeefa6dded635a6895d1 to your computer and use it in GitHub Desktop.
Save mrlynn/ebea9cdbfc34aeefa6dded635a6895d1 to your computer and use it in GitHub Desktop.
AWS CLI Whitelist MongoDB Atlas Live Import IP Ranges
#!/bin/sh
# Enter the connection details of your existing MongoDB cluster.
# NOTE: In order for to process the migration request, our servers need to be able to access your source cluster. Make sure to whitelist the following ip address ranges in your firewall.
# 4.35.16.128/25
# 35.170.231.208/32
# 4.71.186.128/25
# 54.84.208.96/32
MYIP=`dig +short myip.opendns.com @resolver1.opendns.com`
export SG=MySecurityGroup
aws ec2 authorize-security-group-ingress --group-name ${SG} --protocol tcp --port 27017 --cidr ${MYIP}/32
aws ec2 authorize-security-group-ingress --group-name ${SG} --protocol tcp --port 27017 --cidr 4.35.16.128/25
aws ec2 authorize-security-group-ingress --group-name ${SG} --protocol tcp --port 27017 --cidr 35.170.231.208/32
aws ec2 authorize-security-group-ingress --group-name ${SG} --protocol tcp --port 27017 --cidr 4.71.186.128/25
aws ec2 authorize-security-group-ingress --group-name ${SG} --protocol tcp --port 27017 --cidr 54.84.208.96/32
aws ec2 describe-security-groups --group-names ${SG}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment