For AI agents: a documentation index is available at https://www.mongodb.com/ko-kr/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

Create a Local Atlas Deployment

Important

The atlas deployments commands are deprecated as of Atlas CLI version 1.52.0. Use atlas local commands instead. We updated this tutorial to use the atlas local command.

This tutorial shows you how to use the atlas local command to create a local Atlas deployment. This tutorial deploys a single-node replica set on your local computer. You can then manage your deployment, and use MongoDB Search and MongoDB Vector Search.

Operating System
Operating System Version
Architecture
Minimum CPU Cores
Minimum Free RAM (GB)

MacOS

13.2 and later

x86-64, ARM

2

2

Red Hat Enterprise Linux / CentOS

8, 9

x86-64, ARM

2

2

Ubuntu

22.04, 24.04

x86-64, ARM

2

2

Debian

11, 12

x86-64, ARM

2

2

Amazon Linux

2023

x86-64, ARM

2

2

Windows

10, 11

x86

2

2

Before you begin, complete the following prerequisites:

Important

For compatibility information on each product in the dependencies list, see the product's installation documentation.

1
  1. Install the Atlas CLI.

    If you use Homebrew, you can run the following command in your terminal:

brew install mongodb-atlas-cli
For installation instructions on other operating systems,
see :ref:`install-atlas-cli`.
#. Install `Docker <https://www.docker.com/>`__.
Docker requires a network connection for pulling and caching
MongoDB images.
- For MacOS or Windows, install `Docker Desktop v4.31+ <https://docs.docker.com/desktop/release-notes/#4310>`__.
- For Linux, install `Docker Engine v27.0+ <https://docs.docker.com/engine/release-notes/27/>`__.
- For Linux RHEL, you can also use `Podman v5.0+ <https://podman.io>`__.
#. (Optional) Install :mongosh:`mongosh </install>` version 2.0 or later.
.. code-block:: sh
brew install mongosh
For installation instructions on other operating
systems, see :mongosh:`Install mongosh </install>`.
#. (Optional) Install :compass:`Compass </install>` version 1.39.4 or later.
.. code-block:: sh
brew install mongodb-compass
For installation instructions on other operating
systems, see :compass:`Download and Install Compass </install>`.
#. (Optional) Install `Visual Studio Code <https://code.visualstudio.com/download>`__
and `MongoDB for VS Code Extension <https://www.mongodb.com/ko-kr/docs/mongodb-vscode/install/>`__.
To learn more, see `Install MongoDB for VS Code Extension <https://www.mongodb.com/ko-kr/docs/mongodb-vscode/install/>`__.
.. step:: Create an |service| account.
If you don't already have an existing |service| account, run ``atlas setup`` in your terminal
or `create a new account <https://account.mongodb.com/account/register>`__.

Note

A local Atlas deployment uses local networking. Confirm the port you specify (default: dynamic assignment) is available on localhost (127.0.0.1). No virtual private cloud (VPC), firewall, or proxy configuration is required.

Use the atlas local command to create a local Atlas deployment.

You can run this command in the following ways:

  • Interactive Mode (Default): the command prompts you for the deployment settings and provides default values.

  • Interactive Mode (Custom): the command prompts you for the deployment settings and lets you provide custom values.

  • Non-Interactive Mode: you run the command with the specified options. The command does not prompt you to provide further values. To learn all of the actions that atlas local supports, see atlas-local.

Click one of the following tabs to see the command for your preferred mode.

1
atlas local setup
To load MongoDB sample data during setup:
a. Run the following command:
.. code-block:: sh
atlas local setup --loadSampleData true
To initialize the local |service| deployment with your own
data and indexes:
a. Copy the following command:
.. code-block:: sh
atlas local setup --initdb {folder}
#. Replace the ``{folder}`` placeholder with the directory
that contains the ``.js`` and ``.sh`` files to run
inside the local container in alphanumeric order.
#. Run the command.
.. step:: Specify what to deploy.
**Example:**
Specify ``local - Local Database`` and press :kbd:`Enter`..
.. io-code-block::
.. input::
:language: sh
? What would you like to deploy? [Use arrows to move, type to filter, ? for more help]
> local - Local Database
atlas - Atlas Database
.. output::
:language: sh
[Default Settings]
Deployment Name local50
MongoDB Version 7.0
Port 27017
.. step:: Specify how to set up your local Atlas database.
**Example:**
Specify ``default - With default settings`` and press
:kbd:`Enter`..
.. io-code-block::
.. input::
:language: sh
? How do you want to setup your local MongoDB database? [Use arrows to move, type to filter]
> default - With default settings
custom - With custom settings
cancel - Cancel set up
.. output::
:language: sh
Creating your deployment local50 [this might take several minutes]
1/4: Downloading and completing configuration...
2/4: Starting your local environment...
3/4: Downloading MongoDB binaries to your local environment...
4/4: Creating your deployment local50...
Deployment created!
Connection string: mongodb://localhost:27017/?directConnection=true
.. tab:: Interactive (Custom)
:tabid: interactive-custom
.. procedure::
:style: normal
.. step:: Run the ``atlas local`` command in interactive mode.
.. code-block:: sh
atlas local setup
To load MongoDB sample data during setup:
a. Run the following command:
.. code-block:: sh
atlas local setup --loadSampleData true
To initialize the local |service| deployment with your own
data and indexes:
a. Copy the following command:
.. code-block:: sh
atlas local setup --initdb {folder}
#. Replace the ``{folder}`` placeholder with the directory
that contains the ``.js`` and ``.sh`` files to run
inside the local container in alphanumeric order.
#. Run the command.
.. step:: Specify what to deploy.
Specify ``local - Local Database`` and press :kbd:`Enter`..
**Example:**
.. io-code-block::
.. input::
:language: sh
? What would you like to deploy? [Use arrows to move, type to filter, ? for more help]
> local - Local Database
atlas - Atlas Database
.. output::
:language: sh
[Default Settings]
Deployment Name local50
MongoDB Version 7.0
Port 27017
.. step:: Specify how to set up your local Atlas database.
**Example:**
Specify ``custom - With custom settings`` and press
:kbd:`Enter`..
.. code-block:: sh
? How do you want to setup your local MongoDB database? [Use arrows to move, type to filter]
default - With default settings
> custom - With custom settings
cancel - Cancel set up
.. step:: Specify a deployment name.
**Example:**
Specify ``myLocalRs`` and press :kbd:`Enter`..
.. code-block:: sh
? Deployment Name [This can't be changed later] (local3612) myLocalRs
.. step:: Specify a MongoDB Version.
**Example:**
Specify ``7.0`` and press :kbd:`Enter`..
.. code-block:: sh
? MongoDB Version [Use arrows to move, type to filter]
> 7.0
6.0
.. step:: Specify a port.
**Example:**
Specify ``37018`` and press :kbd:`Enter`..
.. io-code-block::
.. input::
:language: sh
? Specify a port (49469) 37018
.. output::
:language: sh
Creating your deployment myLocalRs
1/2: Starting your local environment...
2/2: Creating your deployment myLocalRs...
Deployment created!
Connection string: mongodb://localhost:37018/?directConnection=true
.. tab:: Non-Interactive
:tabid: noninteractive
.. procedure::
:style: normal
.. step:: Run the ``atlas local`` command with the options.
**Example:**
.. io-code-block::
:copyable: true
.. input::
:language: sh
atlas local setup myLocalRs1 --force
.. output::
:language: sh
[Default Settings]
Deployment Name myLocalRs1
MongoDB Version 7.0
Port 49684
Creating your deployment myLocalRs1
1/2: Starting your local environment...
2/2: Creating your deployment myLocalRs1...
Deployment created!
Connection string: mongodb://localhost:49684/?directConnection=true
connection skipped
To initialize the local |service| deployment with your own
data and indexes:
a. Copy the following command:
.. code-block:: sh
atlas local setup myLocalRs1 --force --initdb {folder}
#. Replace the ``{folder}`` placeholder with the directory
that contains the ``.js`` and ``.sh`` files to run
inside the local container in alphanumeric order.
#. Run the command.

After creating your deployment, confirm it is running and that you can connect to it.

Checkpoint
Verification Step

Docker is running

Run docker ps. The command completes without errors.

Deployment created

CLI output shows Deployment created! with a connection string.

Connection succeeds

Run atlas local connect or connect with mongosh using the connection string.

Sample data available (optional)

If you loaded sample data, query a sample database to confirm data is present.

Use the atlas local command to manage a local Atlas deployment.

1

Example:

atlas local list
NAME TYPE MDB VER STATE
local50 LOCAL 7.0.1 IDLE
local62 LOCAL 7.0.1 IDLE
myLocalRs LOCAL 7.0.1 IDLE
myLocalRs1 LOCAL 7.0.1 IDLE
2

Note

You can also load sample data during deployment setup using the --loadSampleData true option with atlas local setup. See the setup examples above.

To load sample data into an existing deployment:

  1. Run the following command to download the sample data:

curl https://atlas-education.s3.amazonaws.com/sampledata.archive -o sampledata.archive
#. Get the port number for your deployment by running the
following command and selecting your deployment:
.. code-block:: sh
atlas local connect --connectWith connectionString
The connection string includes the port number. For example,
in the connection string
``mongodb://localhost:27017/?directConnection=true``, the
port number is ``27017``.
#. Get the port number for your deployment:
i. Copy the following command:
.. code-block:: sh
atlas local connect <deployment name> --connectWith connectionString
#. Replace ``<deployment name>`` with the name of your
deployment.
#. Run the command.
The connection string includes the port number. For
example, in the connection string
``mongodb://localhost:27017/?directConnection=true``, the
port number is ``27017``.
#. Copy and paste the following command into your terminal and
replace ``{port-number}`` with the port for your
deployment:
.. code-block:: sh
mongorestore --archive=sampledata.archive --port={port-number}
.. step:: Connect to a deployment.
a. Run the following command to connect to a deployment:
.. code-block:: sh
atlas local connect
#. Specify the deployment to connect to and press :kbd:`Enter`..
#. Specify how you want to connect to the deployment and press
:kbd:`Enter`..
You can retrieve the connection string or connect to the following clients:
connection string:
- :binary:`~bin.mongosh` if you installed :binary:`~bin.mongosh`
- MongoDB Compass if you installed :compass:`Compass </>`
- Visual Studio Code if you installed `Visual Studio Code <https://code.visualstudio.com/download>`__,
`Visual Studio Code CLI
<https://code.visualstudio.com/download>``__, and ``MongoDB for
VS Code Extension <https://www.mongodb.com/ko-kr/docs/mongodb-vscode/install/>`__
.. step:: Pause a deployment.
a. Run the following command to pause a deployment:
.. code-block:: sh
atlas local stop
#. Specify the deployment to pause and press :kbd:`Enter`..
.. step:: Start a deployment
a. Run the following command to start a deployment:
.. code-block:: sh
atlas local start
#. Specify the deployment to start and press :kbd:`Enter`..
.. step:: Return the logs for the deployment.
a. Run the following command to return the logs for a deployment:
.. code-block:: sh
atlas local logs
#. Specify the deployment to return logs for and press :kbd:`Enter`..
  1. Run the following command to delete a deployment:
atlas local delete
  1. Specify the deployment to delete and press Enter..

  2. Specify y and press Enter. to confirm.

You can use Docker and MongoDB Database Tools to move a local Atlas deployment to a cloud Atlas deployment.

1
atlas setup
.. step:: Create a local |service| deployment.
.. code-block:: sh
atlas local setup
To initialize the local |service| deployment with your own data
and indexes:
a. Copy the following command:
.. code-block:: sh
atlas local setup --initdb {folder}
#. Replace the ``{folder}`` placeholder with the directory
that contains the ``.js`` and ``.sh`` files to run
inside the local container in alphanumeric order.
#. Run the command.
.. step:: Create a binary file of the data.
a. Copy the following command:
.. code-block:: sh
docker exec -u root -it {local_deployment_name} sh -c "mkdir -p /data/dump && chown -R mongod:mongod /data/dump && mongodump --archive=/data/dump/dump.archive"
#. Replace the ``{local-deployment-name}`` placeholder with the
name of your local |service| deployment.
#. Run the command.
.. step:: Copy the archive.
a. Copy the following command:
.. code-block:: sh
docker cp <local deployment name>:/data/dump/dump.archive .
#. Replace the ``{local-deployment-name}`` placeholder with the
name of your local |service| deployment.
#. Run the command.
.. step:: Return the connection string.
.. code-block:: sh
atlas clusters connectionStrings describe
.. step:: Restore from the archived file.
a. Copy the following command:
.. code-block:: sh
mongorestore --uri={connection-string} --archive=./dump.archive
#. Replace the ``{connection-string}`` placeholder with the
connection string.
#. Run the command.
.. step:: (Optional) Delete the local |service| deployment.
.. code-block:: sh
atlas local delete

You can use Docker and MongoDB Database Tools to update a local Atlas deployment to a newer version of the image.

1
atlas local setup
To initialize the local |service| deployment with your own data
and indexes:
a. Copy the following command:
.. code-block:: sh
atlas local setup --initdb {folder}
#. Replace the ``{folder}`` placeholder with the directory
that contains the ``.js`` and ``.sh`` files to run
inside the local container in alphanumeric order.
#. Run the command.
.. step:: Create a binary file of the data.
a. Copy the following command:
.. code-block:: sh
docker exec -u root -it {old-local-deployment-name} sh -c "mkdir -p /data/dump && chown -R mongod:mongod /data/dump && mongodump --archive=/data/dump/dump.archive"
#. Replace the ``{old-local-deployment-name}`` placeholder with
the name of your old local |service| deployment.
#. Run the command.
.. step:: Copy the archive.
a. Copy the following command:
.. code-block:: sh
docker cp {old-local-deployment-name}:/data/dump/dump.archive .
#. Replace the ``{old-local-deployment-name}`` placeholder with
the name of your old local |service| deployment.
#. Run the command.
.. step:: Return the new connection string.
.. code-block:: sh
atlas local connect --connectWith connectionString
.. step:: Restore from the archived file.
a. Copy the following command:
.. code-block:: sh
mongorestore --uri={connection-string} --archive=./dump.archive
#. Replace the ``{connection-string}`` placeholder with the
connection sring.
#. Run the command.
.. step:: (Optional) Delete the old local |service| deployment.
.. code-block:: sh
atlas local delete

Use the atlas local search indexes create command to create an MongoDB Search search index. You can then run MongoDB Search queries. To learn more, see MongoDB Search.

For detailed steps, see Create a MongoDB Search Index and Run a Query.

Use the atlas local search indexes create command to work with MongoDB Vector Search. To learn more, see How to Index Vector Embeddings for Vector Search.

For detailed steps, see Use MongoDB Vector Search with an Atlas Deployment.

Important

To use the Atlas CLI with MongoDB Vector Search, you must create an Atlas deployment with MongoDB 7.0.5 or later. If you created a local Atlas deployment with an earlier MongoDB version, you don't get the latest MongoDB version automatically. You must delete the earlier images and deployments. Then you must create a new Atlas deployment.

To learn all of the actions that atlas local supports, see atlas-local.

After you create and verify your local Atlas deployment, you can:

To learn more about troubleshooting local Atlas deployment issues, see Troubleshoot Local Atlas Deployment Issues.