Connecting to MongoDB Without Credentials in AWS Glue - mongodb

I am trying to move my data in MongoDB to Redshift using AWS Glue. To do this, I am trying to add a connection to MongoDB. My MongoDB setup does not have credentials configured. But the Username and Password fields in the Add Connection page are mandatory. Test Connection fails on giving dummy values as they will be considered during the authentication process. Would appreciate any help in this regard.

To be upfront I haven't tried this myself, but to remove the requirement for Username and Password is easy.
Basically in the Migration Setup Wizard in the "Authentication mode" drop-down box select "none". Default value is "password, where the username and password is mandatory.
Hope that assist.

Related

Forgot mongodb admin database credentials. Reset everything

I forgot the credentials of my admin user.
Hence i am not able to connect to cluster mongo shell.
Now i want to delete all users and and credentials or even if reset of mongodb is possible then it will be a lot help.
I tried following commands but got "authentication required error".
db.createUser(), db.dropDatabase().
I expect to create new admin user with credentials.
you can do it by logging in to your Atlas Cluster here: https://www.mongodb.com. Then, on the left sidebar, you click on 'Database Access'. There you can manage the users and you can even delete them and create new ones.

How to connect MongoDB Compass using MLab connection string

I have database hosted on MLab and I am trying to connect it with Compass. I am using host and port given in connection string but it is showing error, here is my screenshot:
What am I doing wrong?
Had same problem manage to solve it like this:
A. Go to your db in mlab and in the tab choose "users"
B. Create a new user ex: username: admin password: 123456
C: Go to compass and fill it this way
Example of your connection path
ds012345.mlab.com:56789/myDBname
hostname
ds012345.mlab.com
port
56789
authentication: username /password
admin // or the name of the user you created in step A
123456 // or password for the user you created in step A
authentication database
myDBname // the name of your database in mlab
I just had the same problem.
I fixed it by updating my version of MongoDB Compass. No problems encountered with version 1.15.4.
Also, Authentication Database should not have the value "admin" but the name of the DB to connect you.
To make your connection easier, don't hesitate to copy your entire connection string into the clipboard. Compass detects it and proposes to automatically fill in the connection form.
The problem that I had was the Authentication Database Compass filled in automatically wasn't correct for my setup. By default, this was pointing to admin but it needs to point to the database that the user is associated with.
Summed up: The database of admin didn't exist.
Just to rule it out, double check what database you're pointing to. It should be in the name, like ds739176/database_name where database_name is, you guessed it, the name of your database.
Hope this helps.
The required credentials are not your login credentials to MLab,
instead these are database user credentials.
How to get them:
click on your DB on MLab.
go to users tab and create new user.
use the created users credentials to access db.
set authenticationdatabase to be your database.
I had the same problem. MongoDB url was working in code but Authentication failed was showing in MongoDB Compass.
When I checked, my mongodb password was iam%40me1234.
Here I'm using %40 HTML hex code in the password for # character.
So, If we will use the original character in the password like iam#me1234 in MongoDB Compass then it will work great.
Here is a full list of Hex codes
What I did:
Click on "Fill in connection fields individually" option in Compass.
Enter the hostname (Example ds051234.mlab.com)
Enter PORT (Example 12345)
Select Username/password in the Authentication option.
Enter username and password (Create a new user in mlab.com for your database)
Authentication Database (Just enter the "database name" in this field. Example: heroku_8967jgy5)
I hope this will help you.

How does one configure DataGrip to connect to Redshift with SSL?

I am able to connect to Redshift with SSL through SQLWorkbench with the latest driver. When I try to connect using DataGrip and select "Use SSL" with the latest driver, there is a failure.
Has anyone had issues with this? I have also tried adding query parameters to the URL after searching through other posts
?ssl=true&sslfactory=com.amazon.redshift.ssl.NonValidatingFactory
I was able to fix this by removing all other query parameters and embedding the password into the URL string using ?PWD=<password>. Each time I used the password box in the form and clicked "Apply", it would not save the password I entered. This was not an issue with other connections.
As a side note, this works whether I check "Use SSL" or not.

Connecting to MongoDB database on mLab fails authentication

I have a Parse app, and I'm trying to migrate my app's database to a MongoDB instance on mLab.
I already have a fork of Parse Server set up on Heroku, and I'm using Heroku's mLab MongoDB add-on.
I have a database on mLab called heroku_1ksph3jj, and I should be able to connect to it with the following template:
mongodb://<dbuser>:<dbpassword>#ds047124.mlab.com:47124/heroku_1ksph3jj
However, each attempt returns:
Server returned error on SASL authentication step: Authentication failed.
I'm unsure what to replace <dbuser> and <dbpassword> with. I have a database user with the same name as my database: heroku_1ksph3jjz, so I used that. And I used the password for that user in place of <dbpassword>. Should I have used something else here?
You can get the dbuser and dbpass with:
heroku config | grep MONGODB_URI
Grab the dbuser (example_user) and dbpass (example_pass) from the response:
MONGOLAB_URI: mongodb://example_user:example_pass#mlab.com:12345/db
As of March 2016, mLab.com only supports mongo 3.0+ (as per a conversation with support), because of their new onerous authentication requirements.
This was not on the website, but I hope it helps someone here!
There's a message to create a user for the specific database:
A database user is required to connect to this database. To create one now, visit the 'Users' tab and click the 'Add database user' button
I'm so sorry that this may seem obvious but, you have to remove this characters <> for the migration to work
In your example would look like this:
mongodb://dbuser:dbpassword#ds047124.mlab.com:47124/heroku_1ksph3jj
Check your mongo client version. If it is in older major version (probably 2.x), update it to 3.x
For future visitors - don't use special characters in password .Even if you change the special character to ascii or unicode it wont work for mLab using mongoose.
Also don't use mLab credential , use db user credentials . I created a new user.
Eg. For me a password containing # character was replaced with ascii value %40 in URI , which worked when using native mongodb driver.
But on using mongoose, i was always getting Authentication Failed .
I removed special characters and db was authenticated via mongoose.
It looks like it was the password that was incorrect, which I'm assuming was set up by Heroku's mLab add-on. There was no obvious way to reset this in the mLab UI, so in the end I created another database user (with a new username and password) and was able to connect with that just fine.
Just go to your Heroku dashboard and check your settings.
Under the name field there's a big button "Reveal Config Vars". Click it and you'll see a MONGODB_URI var with a uri to your db. It'll look something like this:
mongodb://heroku_user:PASSWORDyourLOOKINGfor#ds2238985.mlab.com:63295/heroku_user
Your password is right after the semicolon after the heroku user name.
I know I am too late, just for information.
For getting the info of mLab account that got auto created when mLab addon got added to the application in your heroku account, try the below command.
heroku config:get MONGODB_URI
Ref:
http://algebra.sci.csueastbay.edu/~grewe/CS6320/Mat/NodeJS/Heroku/Heroku_MLabMongoDB.html

Rename the Amazon RDS master username

Changing the password is easily done through the console. Is there any way to change the master username after creation on RDS for PostgreSQL? If so, how?
You can't change username. You can check the following links that describe how to change master password and if Amazon adds the ability to change username you will find there:
Try to find at AWS CLI for RDS:
modify-db-instance --db-instance-identifier <value> --master-user-password (string)
--master-user-password (string)
The new password for the DB instance master user. Can be any printable
ASCII character except "/", """, or "#".
Changing this parameter does not result in an outage and the change is
asynchronously applied as soon as possible. Between the time of the
request and the completion of the request, the MasterUserPassword
element exists in the PendingModifiedValues element of the operation
response. Default: Uses existing setting
Constraints: Must be 8 to 41 alphanumeric characters (MySQL, MariaDB,
and Amazon Aurora), 8 to 30 alphanumeric characters (Oracle), or 8 to
128 alphanumeric characters (SQL Server).
The Amazon RDS Command Line Interface (CLI) has been deprecated. Instead, use the AWS CLI for RDS.
Via the AWS Management Console, choose the instance you need to reset the password for, click ‘Modify’ then choose a new master password.
If
you don’t want to use the AWS Console, you can use the
rds-modify-db-instance command (as per Amazon’s documentation for RDS)
to reset it directly, given the AWS command line tools:
rds-modify-db-instance instance-name --master-user-password
examplepassword
No. As of April 2019 one cannot reset the 'master username'.
You cannot do it directly. However you can use the database migration service from AWS:
https://aws.amazon.com/dms/
Essentially you define the current database instance as your source and the new database with the correct username as your target of the migration.
This way you migrate the data from one to another database instance. As such you can change all properties including the username.
This approach has some drawbacks:
You need to configure the migration. Which takes a bit of time.
The data is migrated. This may lead unexpected behavior since not everything is eventually migrated (e.g. views etc.)
It depends how you setup everything you may experience a downtime.
Though this may not be ideal for every use-case, I did find a workaround that allows for changing the username of the master user of an AWS RDS DB.
I am using PgAdmin4 with PostgreSQL 14 at the time of writing this answer.
Login with the master user you want to change the name of
Create a new user with the following privileges and membership
Privileges and Membership
Can login - yes
Superuser - no (not possible with a managed AWS RDS DB instance, if you need complete superuser access DO NOT use a managed AWS RDS DB)
Create roles - yes
Create databases - yes
Inherit rights from the parent roles - yes
Can initiate streaming replication and backups - no (again, not possible directly without superuser permission)
Be sure to note the password used, as you will need to access this new account at least 1 time to complete the name change
Register a server with the credentials created in step 2. Disconnect from the server but do NOT remove it! Connect to the new server created
Expand Login/Group Roles and click on the master user whom you are changing the name
Click the edit icon, edit the name, and save.
Right click the server with the master username, select Properties
Update the name under the General tab if desired
Update the username under the Connection tab to whatever you changed the master username above
Save and reconnect to the server with the master user
You have successfully updated the master user's name on a managed AWS RDS DB instance, proud of you!
As #tdubs's answer states, it is possible to change the master username for a Postgres DB instance in AWS RDS. Whether it is advisable – probably not.
Here are the SQL commands you need to issue:
Create a temporary user with the CREATEROLE privilege (while being logged in with the old master user)
CREATE ROLE temp_master PASSWORD '<temporary password>' LOGIN CREATEROLE;
Now connect to the database with the temp_master user
ALTER ROLE "<old_master_username>" RENAME TO "<new_master_username>";
-- NOTICE: MD5 password cleared because of role rename
ALTER ROLE "<new_master_username>" PASSWORD '<new password>';
Now connect to the database with the <new_master_username> user in order to clean up the temporary role
DROP ROLE temp_master;
And you're done!
Warning
AWS RDS does not know that the master username has been changed, so it will keep displaying the old one and assumes that is still the master username.
This means that if you use the AWS CLI or website to update the master password, it will have no effect.
And when connecting to the database with psql you'll see:
WARNING: role "<old_master_username>" does not exist