npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mongo-atlas-update-whitelist-for-aws

v1.1.0

Published

Updates the MongoDB Atlas IP whitelist with IP ranges for AWS services

Downloads

16

Readme

Home of the mawaws command!

Updates your MongoDB Atlas IP whitelist using the published IP ranges for AWS Services. This makes it easy to allow a whole region so, for example, a Lambda function on any EC2 instance in that region will be able to reach your database. This was built for this exact use case and when you cannot use VPC with EC2 NAT to give your Lambda a predicatable IP.

Install

npm install -g mongo-atlas-update-whitelist-for-aws
mawaws help

Running directly

  1. As a pre-requisite, you need to have an API key for MongoDB Atlas. Follow these instructions to get one.
  2. We need to get the ID of the group we want to update:
    mawaws list-groups \
      --user=abcdef \
      --key=4c03c17c-25d8-42fa-a762-bd9c22b5a55a
    ...and you'll see output that looks like:
    # example output
    Listing MongoDB Atlas groups (AKA projects)
    Available groups:
      1ab2bf4c3b53b9822afa9364: Project 1
  3. Now we perform the update to the whitelist for that project, using the ID from the previous command:
    mawaws update-whitelist \
      --region=ap-southeast-2 \
      --groupid=1ab2bf4c3b53b9822afa9364 \
      --user=abcdef \
      --key=4c03c17c-25d8-42fa-a762-bd9c22b5a55a

Note: the default service to get IPs for is EC2, if you wish to target a different service, supply the --service param:

mawaws update-whitelist \
  --service=AMAZON \
  ... # continue with other params

Running with docker

  1. either pull the pre-built docker image with
    docker pull tomsaleeba/mongo-atlas-update-whitelist-for-aws:1.1.0
  2. or, build the image locally with
    # after you've cloned this repo
    docker build -t tomsaleeba/mongo-atlas-update-whitelist-for-aws:1.1.0 .
  3. run the container and pass args like you would to the raw command
    docker run --rm -it tomsaleeba/mongo-atlas-update-whitelist-for-aws:1.1.0 --help
    docker run --rm -it tomsaleeba/mongo-atlas-update-whitelist-for-aws:1.1.0 \
      list-groups --user=abcdef --key=123abc

Running using cron on AWS ECS Fargate

As the list of IP ranges is being updated semi-frequently, it makes sense to run this command on a regular schedule. See the instructions in aws-deploy/README.md for how to set this up.

TODO

  1. make delete function that can remove all entries for a region
  2. lots more validation of command line params