Create your first instance
The following example creates a Linux instance with 2 vCPUs and 4 GiB of memory, prints its instance ID, and waits for it to start.1
Authenticate with Namespace
For local development, authenticate with the Namespace CLI:The SDK uses a Namespace workload token when available and otherwise the local user token created by
nsc login.2
Create a Compute client
Import The client loads credentials on its first authenticated request and uses the
createComputeClient() and create a client:us regional endpoint by default.3
Create an instance
Create a Linux instance with a 30-minute deadline:The deadline releases the instance after 30 minutes.
4
Print the instance ID
Read the instance ID from the response metadata:
5
Wait for the instance
Instance creation is asynchronous. Wait until the instance reaches the
RUNNING state:Explore Compute
Create and manage instances
Create, wait for, inspect, list, extend, suspend, wake, and destroy instances.
Compute Client
Configure authentication, region, and transport, and see every compute service.
Authenticate with Namespace
Configure credentials for local development and automated workloads.
Access and networking
Expose ingresses and read SSH, VNC, and Kubernetes configuration.
Run commands
Run a command in a container and stream or buffer its output.
Inspect and release volumes
List, describe, and destroy cache and persistent volumes.
Report on usage
Compute, volume, and artifact usage, time series, and reports.
Read logs and egress
Stream and fetch instance logs and egress records.
Compute platform
Learn about platforms, machine shapes, storage, and instance access.