Giter VIP home page Giter VIP logo

Comments (3)

alxgrk avatar alxgrk commented on May 23, 2024 1

Ok, thanks for your answer. Unfortunately, it turned out that MongoDB Compass is dumb in that regard - it doesn't check for the environment but simply takes the ACCESS_KEY, etc. as strings via configuration.

For me & especially since I wanted to use a specific role for authentication, the solution was to run aws-vault exec my-profile -- aws sts assume-role --role-arn=my-role-arn --role-session-name=my-role-session & to open MongoDB Compass with the credentials baked in. This would look like the following, pasting it here in case anyone needs it:

openMongoDbCompassWithRole() {
  local output=$(aws-vault exec my-profile -- aws sts assume-role --role-arn=my-role-arn --role-session-name=my-role-session)
  AWS_SESSION_TOKEN=$(echo $output | jq -r '.Credentials.SessionToken')
  ENCODED_TOKEN=$(node -p "encodeURIComponent(\"${AWS_SESSION_TOKEN}\")")
  /Applications/MongoDB\ Compass.app/Contents/MacOS/MongoDB\ Compass \
    --username=$(echo $output | jq -r '.Credentials.AccessKeyId') \
    --password=$(echo $output | jq -r '.Credentials.SecretAccessKey') \
    "mongodb+srv://my.mongodb.com/mydb?authMechanism=MONGODB-AWS&authSource=%24external&authMechanismProperties=AWS_SESSION_TOKEN%3A${ENCODED_TOKEN}" &
}

from aws-vault.

FernandoMiguel avatar FernandoMiguel commented on May 23, 2024

none, and use aws-vault --server

from aws-vault.

pkushnir avatar pkushnir commented on May 23, 2024

Does it work only with temporary credentials?

from aws-vault.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.