Skip to content

Commit 4a35eec

Browse files
authored
(DOCSP-25302) Adds ephemeral clusters tutorial (#167)
* (DOCSP-25302) Adds ephemeral clusters tutorial * Adds changes from copy review (again)
1 parent fec72b0 commit 4a35eec

File tree

2 files changed

+121
-1
lines changed

2 files changed

+121
-1
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
.. _atlas-cli-ephemeral-cluster:
2+
3+
=====================================================
4+
Test Automations with Ephemeral Projects and Clusters
5+
=====================================================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 1
13+
:class: singlecol
14+
15+
This tutorial demonstrates how to quickly create and delete ephemeral
16+
|service| projects and {+clusters+} using the {+atlas-cli+}. Ephemeral
17+
projects and {+clusters+} provide temporary testing environments that
18+
you isolate from your production projects and {+clusters+}. You can use
19+
ephemeral projects and {+clusters+} to test your automation scripts
20+
before using the scripts on production {+clusters+}.
21+
22+
.. _atlas-cli-ephemeral-reqs:
23+
24+
Prerequisites
25+
-------------
26+
27+
Before you begin, complete the following tasks:
28+
29+
- Create an |service| user account.
30+
- :ref:`Create <atlas-organizations-create>` an
31+
:atlas:`Atlas organization </organizations-projects/>` and
32+
note its organization ID. You can find the organization ID by running the :ref:`atlas-organizations-list` command.
33+
- :ref:`install-atlas-cli`.
34+
- :ref:`connect-atlas-cli`.
35+
36+
Follow These Steps
37+
------------------
38+
39+
.. procedure::
40+
:style: normal
41+
42+
.. step:: Create the ephemeral project, {+cluster+}, and database user.
43+
44+
a. Run the :ref:`atlas-users-describe` command to find your
45+
|service| user ID. Replace <YOUR-EMAIL> with the email address
46+
that is associated with your |service| user account.
47+
48+
.. code-block::
49+
50+
atlas users describe --username <YOUR-EMAIL>
51+
52+
b. Run the :ref:`atlas-projects-create` command to create the
53+
ephemeral project. Replace <ORG-ID> with the organization ID
54+
and replace <YOUR-USER-ID> with your |service| user ID that
55+
you retrieved in the previous step.
56+
57+
.. code-block::
58+
59+
atlas projects create myEphemeralProject --orgId <ORG-ID> --ownerId <YOUR-USER-ID>
60+
61+
c. Retrieve the project ID for the ephemeral project you created
62+
from the response. In the following example response, the
63+
project ID is ``64933bde48add154124e343f``.
64+
65+
.. code-block::
66+
67+
Project '64933bde48add154124e343f' created.
68+
69+
Alternatively, you can use the :ref:`atlas-projects-list`
70+
command to find the project ID.
71+
72+
d. Run the :ref:`atlas-quickstart` command to create an ``M10``
73+
{+cluster+} and a database user. Replace <YOUR-PASSWORD> with a password for the database user and replace <PROJECT-ID> with
74+
the project ID for the ephemeral project you created.
75+
76+
.. code-block::
77+
78+
atlas quickstart --clusterName myEphemeralCluster --provider AWS --region US_EAST_1 --tier M10 --username myEphemeralUser --password <YOUR-PASSWORD> --currentIp --skipSampleData --projectId <PROJECT-ID> --force
79+
80+
After |service| creates the {+cluster+}, the {+atlas-cli+}
81+
provides the :manual:`connection string
82+
</reference/connection-string/#connection-string-options>` and
83+
connects to your {+cluster+} through {+mongosh+}.
84+
85+
.. step:: Test your automations on the ephemeral project and {+cluster+}.
86+
87+
.. step:: Delete the ephemeral project, {+cluster+}, and database user.
88+
89+
a. Run the :ref:`atlas-clusters-delete` command to delete the
90+
ephemeral {+cluster+} and its database users. Replace <PROJECT-ID> with the project ID for your ephemeral project.
91+
92+
.. code-block::
93+
94+
atlas clusters delete myEphemeralCluster --projectId <PROJECT-ID> --force
95+
96+
b. Run the :ref:`atlas-projects-delete` command to delete the
97+
ephemeral project. Replace <PROJECT-ID> with the project ID
98+
for your ephemeral project.
99+
100+
.. code-block::
101+
102+
atlas projects delete <PROJECT-ID> --force
103+
104+
.. note::
105+
106+
You can't delete the ephemeral project until the ephemeral
107+
{+cluster+} finishes shutting down. If you get an error
108+
stating ``CANNOT_CLOSE_GROUP_ACTIVE_ATLAS_CLUSTERS``, wait
109+
five minutes, then run the ``atlas projects delete``
110+
command again.
111+
112+
You can run the :ref:`atlas-projects-list` command to confirm
113+
successful deletion of the ephemeral project and {+cluster+}. If
114+
the ephemeral project is missing from the list, you successfully
115+
deleted both the project and the {+cluster+}.

source/atlas-cli-tutorials.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,14 @@ You can also go straight to the :doc:`{+atlas-cli+} Commands
3939
{+cluster+}. This tutorial requires an |service| account and an
4040
existing organization.
4141

42+
* - :ref:`atlas-cli-ephemeral-cluster`
43+
- Create an ephemeral project and {+cluster+} to test automations.
44+
45+
4246
.. toctree::
4347
:titlesonly:
4448

4549
/atlas-cli-getting-started
4650
/atlas-cli-quickstart
47-
/atlas-cli-create-cluster-from-config-file
51+
/atlas-cli-create-cluster-from-config-file
52+
/atlas-cli-ephemeral-cluster

0 commit comments

Comments
 (0)