Step 2 - Infrastructure Setup
Now that your project structure is in place, it’s time to define the infrastructure for your lab. In this step, you’ll see the network your lab already comes with and use it for the container you’ll create, which forms the foundation of your learning environment. You’ll also set up the user interface elements - a terminal for command-line access and a service tab to view the web server.
Create the Infrastructure Configuration
Section titled “Create the Infrastructure Configuration”When you create the lab, you get redirected to the lab overview page. It shows you the lab’s title of your current version (you can see the selected version at the top. It should show Branch: main).
For more information on the lab overview page, see the Lab Overview documentation.
The default Network resource
Section titled “The default Network resource”Let’s start by navigating to the Sandbox tab in the top bar. It already lists a network named main, because every lab created from scratch comes with one.
That network is there because it’s what lets the resources in your sandbox talk to each other. Containers and virtual machines attach to a network to communicate with the rest of the lab, so having one from the start means you can add compute resources right away instead of setting up the networking first.
Its settings are:
- Name:
main- the internal name of the network. It isn’t visible to users; it’s what other resources use to reference the network. - Subnet:
10.0.5.0/24- the address range of the network in CIDR notation. - Enable IPv6: off by default, and the only optional field.
These defaults are fine for this guide, and the container you’re about to create will attach to this network. If you do want to change them, select the network in the Sandbox tab once you’re in edit mode.
You can also add more networks, for example to separate containers into different segments: click the + button in the Sandbox tab, choose Network, fill in a name and subnet, then click Add changes.
For additional details on networks, refer to the Network documentation.
Creating a Container resource
Section titled “Creating a Container resource”Next, create the web server container. To add resources of your own you first need to enter Edit mode by clicking the purple Edit mode button at the top. This creates a separate copy of the main branch for you to work in, so any changes you make are isolated and won’t affect the main version until you save them.
Now click the + button in the Sandbox tab and choose Container.
The container form is organized into collapsible sections. The Image and Resources sections are expanded by default, while other sections are collapsed. For this lab, you only need to configure a few:
- Name:
webserver - Image: The Image section is already expanded. Select Add a new public or private image on GCP and enter:
nginx:1.25
- Port: Expand the Ports section and click Add port, then set:
- Local (local port on the host machine):
80 - You can also set Host as port inside the container. If the host port is not set, the same value as the container local port will be used
- Local (local port on the host machine):
- Network: Expand the Network section and click Add network, then select the default network (
main).
Leave the other options as default. When finished, click Add changes.
This adds the container resource to your environment. It now appears in the Sandbox tab alongside the network.
For additional details on creating containers, refer to the Container documentation.
If you want to see the code this generated, open the More actions menu (the ⋮ icon next to Publish) and choose Review changes. It shows the container resource as a file diff, read-only, so you can check what you’re about to publish. Click the back arrow icon at the top to return to edit mode and keep going.
For the full lifecycle of adding, reviewing, and publishing changes, see Editing & Publishing.
Create User Interface Elements
Section titled “Create User Interface Elements”Now you need to create the interface that users will actually see and use. This includes a service tab (so they can view the web server in their browser) and a terminal tab (so they can run commands on the server). These UI elements connect to the infrastructure you just created:
- The service tab exposes the container’s web server
- The terminal gives command-line access to the same container.
Let’s move to the Tabs tab so we can create these interface elements.
Creating a Service Tab
Section titled “Creating a Service Tab”Click the + button in the Tabs tab and choose Service/Web Application.
Let’s configure the service tab:
- Name:
webserver - Target: Select the container you created earlier (
webserver). - Scheme:
http - Port:
80
When finished, click Add changes.
For additional details on creating service tabs, refer to the Creating Tabs documentation.
Creating a Terminal Tab
Section titled “Creating a Terminal Tab”Let’s also create the terminal tab now. Click the + button again in the Tabs tab and choose Terminal.
Configure the terminal tab as follows:
- Name:
shell - Target: Select the container you created earlier (
webserver). - Shell:
/bin/bash
When finished, click Add changes.
For additional details on creating terminal tabs, refer to the Creating Tabs documentation.
Review and Save Changes
Section titled “Review and Save Changes”Now that you’ve created the container, service tab, and terminal tab, it’s time to publish your changes. Each of those pages needed its own Add changes click, but nothing is saved to the lab until you publish.
If you want to see everything you’ve added in one place first, open the More actions menu and choose Review changes. It lists every changed file as a diff, read-only, so you can double check what you’re about to publish.
Click Publish in the top bar to open the Save changes dialog. Choose Save to this branch to merge directly into main, or Save to new branch… if you’d rather keep main unchanged for now. Let’s just save to main for this guide. Add a changes title (required) and, if you like, a description of what you did, then click Save changes to commit.
For the full breakdown of edit mode, adding changes, reviewing, and publishing, see Editing & Publishing.
What You’ve Built
Section titled “What You’ve Built”You’ve successfully created the infrastructure foundation for your lab:
- Network infrastructure - the default
mainnetwork that provides isolated networking for your lab environment - Container infrastructure running nginx web server that users will customize
- User interface elements including terminal access and web service viewing
Your lab now has a complete infrastructure setup that users can interact with. The next step is to make it truly interactive by adding educational content and validation tasks.
What’s Next
Section titled “What’s Next”In the next step, you’ll create interactive content and tasks that guide users through hands-on activities while automatically validating their progress.
