Install MongoDB with Security on Windows Server 2016

Visits: 26275

MongoDB on Windows Server 2016 with Security

MongoDB on Windows Server 2016 is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas. MongoDB on Windows Server with Security combines the convenience of MongoDB with security. Default installations of MongoDB come without password, so anyone anywhere can delete ALL of your data, that is why this server is by  default has security.

As a Windows server you get all of the benefits of using Windows with the familiar Windows File Manager and text Editors.

Easy installation of MongoDB  on Windows Server 2016 can be found at: https://aws.amazon.com/marketplace/

Access Instructions to connect with MongoDB from Floating Cloud.

When you login the first time to the Windows Server via Remote Desktop (RDP) it produces the MongoDB password. So you have 2 passwords to start: (1) the Windows Password; (2) The MongoDb password which is the same as your Instance ID.

Remote Desktop connection to your Windows EC2 instance.

In order to easily manage your MongoDB on Windows Server with Security, you need to connect via Windows Remote Desktop program.

Remote Desktop login uses a Password randomly assigned by AWS

To login to your server from Windows , right click on your instance ID, in the AWS Ec2 Panel,

Select “Connect”

Get Password using your previously downloaded key by following the on screen AWS instructions

Click on “Download Remote Desktop”

Open the downloaded File and paste your decrypted password when asked to do so.

MongoDB Has already been installed as a Service

We have installed a DB password for you.

The DB Password is the same as your instance ID. You can find it in the AWS EC2 Panel, select your new Floating Cloud  MongoDB Instance. The Instance ID is in the lower pane.

The preinstalled username is “floating”

Access Mongo via Powershell, type:

mongo  admin -u floating -p <INSTANCE-ID>

See our selection of pre-installed MongoDB servers:

 

Get started by creating a user that can administer and work

The user floating is limited in admin capabilities. This makes it more secure. In order to start working is need to create a root user.

Login to mongo db

mongo  admin -u floating  -p <INSTANCE-ID>

from the Mongo CLI prompt, add a root user that can create databases

db.createUser(

  {

    user: “ROOT-USERNAME”,

    pwd: “SECURE-PASSOWORD”,

    roles: [ { role: “root”, db: “admin” } ]

  }

);

Optionally, you can give root access to the “floating” user

db.updateUser(
“floating”,
{
roles : [ { role: “root”, db: “admin” } ]
}
);

Remote CLI connection to MongoDB using a password.

In the above command, “admin” is the DB name. The remote connection URL below has the DB name admin at the end. Use a different db name to connect to that one

For Remote CLI connection, open a Powershell window on computer that has MongoDB installed. If MongoDB isn’t installed you wont be able to use its command line.

mongo mongodb://PUBLICDNS-OR-IP:27017/admin -u floating -p INSTANCE-ID

From the MongoDB Shell you can see installed DB’s type”show dbs”

From here you can build, develop and learn,

You can download MongoDB drivers from https://docs.mongodb.com/ecosystem/drivers/

Good luck!

Easy installation of MongoDB  on Windows Server 2016 can be found at: https://aws.amazon.com/marketplace/


From git readme

I put the reset password script to get AWS Instance ID then set it as the password

The script is in “edit group policy” —> User Configuration —-> Windows Settings —-> Scripts Logon Logoff —-> Logon —-> Powershell Scripts.

gets the set password script
Subscriber needs to login to admin, which automatically runs the script. Without this they cant access the DB.
Select run windows powershell scripts last for run scripts in the following order

connect via mongo mongodb://52.87.177.43:27017/admin -u floating -p i-09846545d2f3bd0d9

mongo mongodb://HOSTNAMEORIP:27017/admin -u floating -p i-INSTANCE-ID

You can download drivers from https://docs.mongodb.com/ecosystem/drivers/

put at the top Access Instructions after short Description and Link to Product

Create MongoDB Replica Set in Docker on Ubuntu

The simplest way to create a multi region MongoDB Replica set using Docker Swarm is to use our scripts that are already written. They launch a CloudFormation and the scripts written below.

In order to run the CloudFormation you need to subscribe to the AWS Image in the AWS Marketplace.

https://aws.amazon.com/marketplace/pp/B01N9N0KFZ/

Then run the CloudFormation Script:

https://console.aws.amazon.com/cloudformation/

See our blog for full instructions to install MongoDB Replica Set in Docker Swarm:

MongoDB Replica Set in Docker Swarm Quick Installation Guide

You can read about installing a MongoDB Replica Set on Docker Swarm .

 

swarm script

 

HowTo: Install MongoDB Replica Set with Docker Swarm in Multiple Regions

You can select various other MongoDB installations on Windows or Linux that we have installed in AWS Marketplace:

Relate Blog articles

https://floatingcloud.io/make-xfs-faield-mkfs-xfs-no-such-file-or-directory/

https://floatingcloud.io/create-mongodb-database-windows-nosql-db/

https://floatingcloud.io/kubernetes-running-mongodb-on-kubernetes-with-statefulsets/

Mongodb-replica-set-in-docker-swarm-quick-installation-guide