Creating and managing an Instance with CLI (v2)
Scaleway Instances provide you with resources to develop, test code and deploy your applications in no time. Instances are designed for modern workflows. They are with you from prototyping to large-scale deployment. You can create and manage your Instances from the console, via the API or the Scaleway Command Line Interface.
Scaleway Command Line Interface (CLI) overview
The Scaleway Command Line Interface (CLI) allows you to pilot your Scaleway infrastructure directly from your terminal, providing a faster way to administer and monitor your resources. Scaleway CLI is easy to set up and use, and an essential tool for operating efficiently in your cloud environment. The CLI provides many functionalities, including the ability to create and manage Instances.
Before you start
To complete the actions presented below, you must have:
- A Scaleway account logged into the console
- Owner status or IAM permissions allowing you to perform actions in the intended Organization
- Created an SSH key
- A valid API key
- Downloaded and installed the Scaleway CLI v2
Configuring the CLI
-
Open a terminal and type the following command to configure the Scaleway CLI on your machine:
scw init
If you have already configured the CLI, you will see a message similar to the following:
Current config is located at /path/to/config.yaml access_key: <YOUR ACCESS KEY> secret_key: <YOUR SECRET KEY> default_organization_id: <YOUR ORGANIZATION ID> default_project_id: <YOUR PROJECT ID> default_region: <YOUR DEFAULT REGION, eg fr-par> default_zone: <YOUR DEFAULT ZONE, eg fr-par-1> Do you want to override the current config? (Y/n):
-
Unless you want to change your configuration, type
n
and go directly to the Creating an Instance step of this tutorial.If you have not yet configured the CLI, you will be guided through the configuration process via a series of questions:
Enter a valid secret-key or an email
-
Enter either the email address for your account (you will then be asked for your password), or your API secret key:
To improve this tool we rely on diagnostic and usage data. Sending such data is optional and can be disabled at any time by running "scw config set send-telemetry=false". Do you want to send usage statistics and diagnostics? (Y/n):
Type
y
orn
and hit enter.To fully enjoy Scaleway CLI we recommend you install autocomplete support in your shell. Do you want to install autocomplete? (Y/n):
Type
y
orn
and hit enter.To enable autocomplete, scw needs to update your shell configuration. What type of shell are you using (default: zsh):
-
Enter your shell type and hit enter.
To enable autocomplete we need to append to /Users/yourusername/.zshrc the following lines: # Scaleway CLI autocomplete initialization. eval "$(scw autocomplete script shell=zsh)" Do you want to proceed with these changes? (Y/n):
Type
y
orn
and hit enter. This should complete the configuration process:Initialization completed with success.
Creating an Instance
-
Type the following command in your terminal to obtain a local-image UUID:
scw marketplace image get label=ubuntu_noble
Details of the image as well as its ID are displayed:
Image: ID 607b12c2-685d-45f7-905f-57bc23863834 Label ubuntu_noble Name Ubuntu 24.04 Noble Numbat UpdatedAt 1 week ago CreatedAt 1 year ago Description Ubuntu is the ideal distribution for scale-out computing, Ubuntu Server helps you make the most of your infrastructure.
-
Run the following command to create an Instance:
scw instance server create zone=fr-par-1 image=ubuntu_noble type=DEV1-S
An output similar to the following should display:
ID 12345678-1234-1234-4321-123456789123 Name cli-srv-romantic-einstein Organization 12345678-1234-1234-4321-123456789123 Project 12345678-1234-1234-4321-123456789123 AllowedActions.0 poweron AllowedActions.1 backup CommercialType DEV1-S CreationDate 1 second ago DynamicIPRequired true RoutedIPEnabled true EnableIPv6 false Hostname cli-srv-romantic-einstein Image.ID 12345678-1234-1234-4321-123456789123 Image.Name Ubuntu 24.04 Noble Numbat Image.Arch x86_64 Image.CreationDate 1 week ago Image.ModificationDate 1 week ago Image.ExtraVolumes 0 Image.FromServer - Image.Organization 12345678-1234-1234-4321-123456789123 Image.Public true Image.RootVolume 12345678-1234-1234-4321-123456789123 Image.State available Image.Project 12345678-1234-1234-4321-123456789123 Image.Zone fr-par-1 Protected false PublicIP.ID 12345678-1234-1234-4321-123456789123 PublicIP.Address 51.158.x.y PublicIP.Gateway 62.210.0.1 PublicIP.Netmask 32 PublicIP.Family inet PublicIP.Dynamic false PublicIP.ProvisioningMode dhcp PublicIP.IpamID 12345678-1234-1234-4321-123456789123 PublicIP.State attached PublicIPs.0.ID 12345678-1234-1234-4321-123456789123 PublicIPs.0.Address 51.158.x.y PublicIPs.0.Gateway 62.210.0.1 PublicIPs.0.Netmask 32 PublicIPs.0.Family inet PublicIPs.0.Dynamic false PublicIPs.0.ProvisioningMode dhcp PublicIPs.0.IpamID 12345678-1234-1234-4321-123456789123 PublicIPs.0.State attached MacAddress de:00:00:ca:58:55 ModificationDate 1 second ago State archived BootType local Volumes.0.ID 12345678-1234-1234-4321-123456789123 Volumes.0.VolumeType sbs_volume Volumes.0.State available Volumes.0.Boot false Volumes.0.Zone fr-par-1 SecurityGroup.ID 12345678-1234-1234-4321-123456789123 SecurityGroup.Name Base group StateDetail - Arch x86_64 Zone fr-par-1 EndOfService false
Creating an Instance local volume
-
Run the following command to create an Instance volume with a size of 50 GB:
scw instance volume create size=50GB name=my-volume
You will see an output like the following:
ID 12345678-1234-1234-4321-123456789123 Name my-volume ExportURI - Size 50 GB VolumeType l_ssd CreationDate now ModificationDate now Organization 12345678-1234-1234-4321-123456789123 Project 12345678-1234-1234-4321-123456789123 State available Zone fr-par-1
-
Write down the ID of your Instance, as you will need it in the next steps.
Creating and attaching a block volume to an Instance
-
Run the following command to create a block volume:
scw block volume create name=my-volume from-empty.size=10G perf-iops=5000
Your block volume has been created:
ID 12345678-1234-1234-4321-123456789123 Name my-volume Type sbs_volume Size 10 GB ProjectID 12345678-1234-1234-4321-123456789123 CreatedAt now UpdatedAt now Status creating Zone fr-par-1 Specs.PerfIops 5000 Specs.Class sbs
-
Write down your block volume's ID. You will need it in the next steps.
-
Type the following command in your terminal to attach your block volume to your Instance. Make sure you replace
<SERVER_ID>
with your server ID and<VOLUME_ID>
with your volume ID.scw instance server attach-volume server-id=<SERVER_ID> volume-id=<VOLUME_ID>
You will see an output similar to the following:
Server.ID 12345678-1234-1234-4321-123456789123 Server.Name scw-keen-fermi Server.Organization 12345678-1234-1234-4321-123456789123 Server.Project 12345678-1234-1234-4321-123456789123 Server.CommercialType DEV1-S Server.CreationDate 40 seconds ago Server.DynamicIPRequired false Server.RoutedIPEnabled true Server.EnableIPv6 false Server.Hostname scw-keen-fermi Server.Image.ID 12345678-1234-1234-4321-123456789123 Server.Image.Name Ubuntu 24.04 Noble Numbat Server.Image.Arch x86_64 Server.Image.CreationDate 1 week ago Server.Image.ModificationDate 1 week ago Server.Image.ExtraVolumes 0 Server.Image.FromServer - Server.Image.Organization 12345678-1234-1234-4321-123456789123 Server.Image.Public true Server.Image.RootVolume 12345678-1234-1234-4321-123456789123 Server.Image.State available Server.Image.Project 12345678-1234-1234-4321-123456789123 Server.Image.Zone fr-par-1 Server.Protected false Server.PublicIP.ID 12345678-1234-1234-4321-123456789123 Server.PublicIP.Address 51.158.x.y Server.PublicIP.Gateway 62.210.0.1 Server.PublicIP.Netmask 32 Server.PublicIP.Family inet Server.PublicIP.Dynamic false Server.PublicIP.ProvisioningMode dhcp Server.PublicIP.IpamID 12345678-1234-1234-4321-123456789123 Server.PublicIP.State attached Server.PublicIPs.0.ID 12345678-1234-1234-4321-123456789123 Server.PublicIPs.0.Address 51.158.x.y Server.PublicIPs.0.Gateway 62.210.0.1 Server.PublicIPs.0.Netmask 32 Server.PublicIPs.0.Family inet Server.PublicIPs.0.Dynamic false Server.PublicIPs.0.ProvisioningMode dhcp Server.PublicIPs.0.IpamID 12345678-1234-1234-4321-123456789123 Server.PublicIPs.0.State attached Server.PublicIPs.1.ID 12345678-1234-1234-4321-123456789123 Server.PublicIPs.1.Address 2001:bc8::1 Server.PublicIPs.1.Gateway fe80::dc00:ff:feca:57bc Server.PublicIPs.1.Netmask 64 Server.PublicIPs.1.Family inet6 Server.PublicIPs.1.Dynamic false Server.PublicIPs.1.ProvisioningMode slaac Server.PublicIPs.1.IpamID 12345678-1234-1234-4321-123456789123 Server.PublicIPs.1.State attached Server.MacAddress de:00:00:ca:57:bb Server.ModificationDate 35 seconds ago Server.State running Server.Location fr-par-1 Server.BootType local Server.Volumes.0.ID 12345678-1234-1234-4321-123456789123 Server.Volumes.0.VolumeType sbs_volume Server.Volumes.0.State available Server.Volumes.0.Boot false Server.Volumes.0.Zone fr-par-1 Server.Volumes.1.ID 12345678-1234-1234-4321-123456789123 Server.Volumes.1.VolumeType sbs_volume Server.Volumes.1.State attaching Server.Volumes.1.Boot false Server.Volumes.1.Zone fr-par-1 Server.SecurityGroup.ID 12345678-1234-1234-4321-123456789123 Server.SecurityGroup.Name Base group Server.StateDetail booting kernel Server.Arch x86_64 Server.Zone fr-par-1 Server.EndOfService false
Powering off an Instance
Type the following command in your terminal and replace <SERVER_ID>
with the ID of your server.
scw instance server stop <SERVER_ID>
You will see the following output:
ā
Poweroff successfully started for the server.
Your Instance has been powered off.
Deleting an Instance
Ensure your Instance is powered off and then run the following command, replacing <SERVER_ID>
with the ID of your server.
scw instance server delete <SERVER_ID>
You will see an output similar to the following example:
successfully deleted volume (- sbs_volume)
successfully deleted volume (- sbs_volume)
ā
Success.