Jump toUpdate content

Quickstart

Reviewed on 26 May 2021Published on 26 May 2021

Projects are Scaleway’s resource management feature. Designed to help you organize your infrastructure and cloud services, the feature allows your resources to be isolated and grouped into specific projects. Each project has its own credentials, so you can control access to the grouped resources.

Each account has a default project which is automatically generated when the account is created. Unless you create additional projects, all resources that you create will be grouped under your default project.

In order to be able to connect to the Instances and other resources you create, you will need to create an SSH key for your project. The advantage of creating and uploading your SSH key to your project before you start creating resources, is that you will then be prompted to associate the uploaded SSH key with the resource during the resource creation, making it easier for you to manage your SSH access.

If you wish to use the Scaleway API to manage your resources, you will also need to generate an API key for your project. This can be done at any time.

How to create an SSH key

SSH keys allow you to securely connect to your compute instances without using a password.

You can create the SSH key pair on your local machine. The process will depend on your operating system.

How to create an SSH key pair on OSX and Linux

On OSX and Linux, you can create the SSH key pair directly from the terminal (command line).

  1. Open the terminal application.

  2. Type ssh-keygen -o -b 4096 and press Enter to generate a new key.

    Important:

    For security reasons you must generate a 2048-bit or 4096-bit RSA key (hence the -b 4096 part of the command). Older 1024-bit keys are no longer supported. The -o option was added in 2014, to specify use of the new OpenSSH format. If the command fails for you, try removing the -o.

  3. Enter a filepath to save the key to when prompted. Alternatively, press Enter to leave this at the default setting (the key will be saved in a file called id_rsa in the /Users/me/.ssh directory).

    Enter file in which to save the key (/Users/me/.ssh/id_rsa):`
  4. Enter a passphrase when prompted. This step is not mandatory, but is recommended for increased security. The passphrase can be freely chosen. If you do not want to set a passphrase, press Enter directly.

    Enter passphrase (empty for no passphrase):
  5. Enter the passphrase again for confirmation when prompted, and press Enter:

    Enter same passphrase again:

    The key pair is generated in the filepath you specified. The key pair consists of:

    • The public key, named id\_rsa.pub
    • The private (identification) key, named id\_rsa
  6. Display the content of the public key with the following command and copy it.

    cat /Users/me/.ssh/id_rsa.pub
  7. Copy the content of the public key. You will need this in the next step. Your key should look something like the output shown:

    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC/tcOt7Lwx5MEPyHo+pcK/XYi7ZvZi4OzLZd59E2MyTLg5ZTpMyRqgLLojTloXEtM57A9H95zjNsiU1nJm1iXEMbRfd6f8fWaaK0ms6z5hLgcuDJot0BkfgThpJjIseZ2uEIrEFYOfdhffJofXkC8lS7seEM8B9TG+Y25wFDdILACrX6AHzRd0Bd4T7I8zNL51fT2zKUBaB6hX4K3rm60K5VKZsZBMj/Mg6rI1DifpOmEb9c+gNX5OlRGC+PREQ08dlwONOO+/C+RPCk+mf1hI5if5E6BAGPz7wN5DNN4BjbiR8/rQ/vjvp5CXbWxaL35FIfi/fUFy3mJlz8u17MzEqi22qdsPXC/MvmdJZSGaAIlqHnNoiMgJTjXBaTJGMiRiuGZ5J3ksIjEeLVAGJNLJRUAOPNmTa9xpn0KD6Uh3OJVUwldGPjJYYHjcNhZTsUqyVpci03fbSvWIvlOlIAc7JicW3ES3i5ayIMNRLwYOp8VP5j8nbpB/OfjRu5VsSQpLJFjcK0LCs+eZaStTn4j3/lwR1DKH3dAwVkRls7SfaWzAgV7HF9NTnDADdVz6wHLR2PB4b7ZVdTYqVXgSjiJfYYYowZ2McIV27cXvbNIWUOJi80h63e/43xSjalBIpDNBi0yTvZqOJzu3xBB6QqJqEmKvAszrTVoGK8rgLgC/iw== me@localhost

How to create an SSH key pair on Windows

On Windows, you can use the third-party application PuTTYgen to create an SSH key pair.

  1. Download and install PuTTY to your local computer. The PuTTYgen application is automatically installed (as well as the main PuTTY application).

  2. Launch PuTTYgen by double-clicking on the application icon. The following screen displays.

  3. Select RSA, set the number of bits in the key to 4096 and click the Generate button:

  4. Move the mouse around the blank area as instructed, to generate randomness.

    The public and private keys are generated and the following screen displays:

  5. Complete the steps on the screen to finish:

  • Fill in the Key-comment field with a name to help you identify this key pair
  • Click the Save public key button and save it in the folder of your choice
  • Click the Save private key button and save it the same folder
  • Select the content of the public key (the sequence of characters under “Public key for pasting into OpenSSH authorized_keys file”). Copy it, as you will need this in the next step.

How to upload the public SSH key to your Scaleway project

You must upload the content of the public part of the SSH key pair you just created to the Scaleway interface. This is then associated with your project, and can be transferred to your compute instances during the boot process.

  1. From the Scaleway console, navigate to the Credentials tab of your Project Dashboard.

  2. Scroll down to the SSH Key section, and click Add a new SSH key.

  3. Paste the content of the public key (which you copied in the previous step) into the pop-up box, and optionally add a description. Then click Add a SSH key.

You will now be able to connect to your instances via SSH

How to add resources to your project

To add a new resource to your project, first ensure you are currently editing the correct project.

  1. Click Project Dashboard in the Scaleway Console side menu to check if you are logged in the correct project.

  2. You can also check if the name of your project appears in the Selected Project dropdown menu.

  3. Select the resource you want to create from the console side menu.

  4. Click the resource and follow deployment instructions.

Once the resource is created, it is automatically included in your Project.

How to generate an API key

API keys are unique identifiers associated with your Scaleway projects and consist of an Access Key and a Secret Key. They allow you to use the Scaleway API. Each Scaleway project can have several API keys, to give multiple accesses to the same project.

Creating an API key can be done directly from the Scaleway console:

  1. From the Scaleway console, navigate to the Credentials tab of your Project Dashboard.

  2. Scroll down to the API Key section.

  3. Click Generate new API key. The following pop-up appears.

  4. Add an API Key purpose (for your own reference), or leave this blank. Then click Generate API Key.

    The two parts of your API Key (Access Key and Secret Key) are displayed. Take careful note of the Secret Key, as it will not be recoverable or viewable after this point.

  5. Click OK to conclude.

How to use your API key

This is an example of one way you can use your API key: to make a call to the Scaleway Authentication API. You will store your Access Key and Secret Key as environment variables. Then, you will use curl to call the Scaleway API and authenticate yourself with your API key. You will receive back a token containing information about your account, including your user_id, project_id and organization_id, among other details.

Tip:

These instructions are for Linux/Mac operating systems. For Windows, when storing environment variables, use the set command instead of export.

  1. Open a terminal and execute the following commands. Replace your_access_key and your_secret_key with the access and secret keys you generated at the previous step.

    export SCW_ACCESS_KEY=your_access_key
    export SCW_SECRET_KEY=your_secret_key
    Tip:

    You will need to repeat these export commands every time you open a new shell session. To avoid the need for repetition, open your ~/.bashrc or ~/.zshrc files in a text editor and append the export commands to the file. Save and exit the file, and perform source ~/.bashrc (or source ~/.zshrc) to finish.

  2. Execute the following command:

curl https://account.scaleway.com/tokens/$SCW_ACCESS_KEY -H "X-Auth-Token: $SCW_SECRET_KEY"

You will receive a response similar to the following:

{
"token": {
"access_key": <SCW_ACCESS_KEY>,
"user_id": <SCW_USER_ID>,
"expires": null,
"creation_date": "2020-11-09T14:23:45.927530+00:00",
"creation_ip": "195.154.229.35",
"category": "user_created",
"deletion_date": null,
"inherits_user_perms": false,
"roles": {
"role": null,
"organization": null
},
"description": "",
"project_id": <SCW_PROJECT_ID>,
"organization_id": <SCW_ORGANIZATION_ID>,
"use_role_key": true
}
}

You can use your API key to authenticate yourself against the Scaleway Developer API, and use this to create and manage all your Scaleway resources.