Skip to main content

๐Ÿ‘ RUN : Network Challenge

info

The provided scripts are incomplete. Replace all <CODE_BLOCK> with the correct code to complete the lab.

1. Add "My current IP" temporary into the atlas projectโ€‹

from datetime import datetime, timedelta
from zoneinfo import ZoneInfo

# Calculate the date and time 24 hours from now
delete_after = (datetime.now(ZoneInfo('UTC')) + timedelta(hours=24)).isoformat()

!atlas accessLists <CODE_BLOCK>
tip

Docs : atlas accessList

Answer
from datetime import datetime, timedelta
from zoneinfo import ZoneInfo

# Calculate the date and time 24 hours from now
delete_after = (datetime.now(ZoneInfo('UTC')) + timedelta(hours=24)).isoformat()

!atlas accessLists create --currentIp --projectId {project_id} --deleteAfter {delete_after}
info

The IP added is the "local" IP for the environment running the notebook. If you're running this in Instruqt, Google Collab or Codespaces this local IP will not be your computer's local IP.

2. Check that "My current IP" was addedโ€‹

!atlas accessLists list --output json --projectId {project_id}

You should get a JSON document that contains information in the results array.

Next stepsโ€‹

Start the chapter on authentication for database user management.