Welcome back. In the last video, we went over the fundamentals of the OCI CLI. In this video, we'll work through a couple of examples of writing CLI commands. We'll start by provisioning a subnet in this VCN. Let's open up the Cloud Shell so we don't have to worry about installation or authentication. We can open up the CLI in interactive mode with oci-i. Now we can use its auto-completion to fill in network subnet create. You can see that it lists all the parameters and highlights the required ones in red. Let's start with cidr block and fill in 10.0.2.0/24. Now let's fill in compartment ID. It will be blurred in the video, but the drop-down shows the display names of all of the compartments in the tenancy. It will fill in the corresponding OCID that we select. Now we can do the same for VCNID. Let's also add an optional parameter for display name. Let's name it, example subnet. Let's hit "Enter". Now we'll see a new subnet pop up titled example subnet. There we go. Now, interactive mode is great and does a lot of work us. It can't quite help us out for parameters that take complex types. To work through an example of that, let's provision an ARM compute instance. Let's start by running OCI compute instance launch and -h to see the required parameters. We can see that we need the availability domain, compartmental OCID, shape, and subnet ID. Compartmental OCID and subnet OCID are fairly straightforward. But we'll need to figure out what to put for availability, domain and shape. As you'd expect, you can refer to each AD of a region with a name. For example, Phoenix has PHX-AD-1 and PHX-AD-2, etc. But in order to distribute load across the ADs, OCI assigns a prefix to these names that will vary by tenancy. That way, your AD-1 might be different from my AD-1. To see what my AD names are, we'll query the IAM service. With OCI, IAM, availability domain list. Now we can see the names of my ADs as well as their OCIDs. Now let's figure out what to put for the shape of the compute instance. To do this, we can query the compute service for the available shapes with OCI, compute, shape list and let's pass it a compartment ID. But if we scroll through this, we could see that it returns a lot more than just the names. For each shape, it also gives all of the metadata around it. Just so we don't have to sift for names specifically, I'm going to run the command again, but with a filter for the shape, name, and description. I'll do that with query, and then data.shape processor description. This quiz is the James path language, spelled J-M-E-S path. But that's a little out of the scope of this video. For now, you can just note this down and paste it for whenever you need. While I'm at it, let's format the output as a table and pipe it into less. Now, we can see our choice down at the bottom, VMstandard.A1.flex. Now let's fill in all of the required parameters and try launching this instance. OCI, compute, instance, launch, availability, domain, the string we noted earlier. We'll pass it a compartmental OCID, we'll specify the shape name we just chose. Let's give it a subnet ID. Let's go ahead and run that. We see that it didn't work. This is because in addition to the individually required parameters, sometimes there are sets of optional parameters from which at least one must be specified. In this case, we have to either specify an image or boot volume, which makes sense if we think about provisioning from the console. Let's specify an image. To get the OCID's of images, we can query the compute service with OCI compute image list and we'll pass it to compartment. We can filter by our chosen shape with shape VM.Standard.A1.flex. Just so we can scroll through it, let's pipe it into less. Like with shapes, it returns a lot more than we really want to look at right now. I'll rerun it but with a filter for just the display name and the OCID, and less output as a table. Great. We can note any of these down. I'll choose the latest Ubuntu image and we try our command. Image ID and paste that in. It doesn't work again. This is because we specified a flex shape, but it doesn't really make sense to specify a flex shape without also specifying OCPUs and memory size. Let's figure out how to use the shape config parameter with OCI , compute, instance, launch, and then generate param, json, input, shape, config. We get a little template that we can fill in. For ARM flex shapes, baseline OCPU utilization and NVMes don't really make sense, so we'll omit that. For the last time, let's fill in our command and add shape config. Then a JSON string saying memoryInGBs, we'll say 16 and OCPUs, we'll say one. If we minimize this, we'll see a new instance pop up. Obviously, that was way harder than just going through the console and provisioning one. But in scenarios where we want to provision a hundreds or even just tens of these, the CLI will save us a lot of time, especially after we get comfortable with it.