Créer une access key

Vous pouvez créer une access key pour votre compte. Les access keys vous permettent de signer vos requêtes API. La nouvelle access key est automatiquement spécifiée comme ACTIVE, lui permettant de signer des requêtes.

Pour utiliser l’API et pour signer vos requêtes, vous devez retrouver dans Cockpit l’une des access keys déjà créées pour votre compte. Pour en savoir plus, voir Obtenir des informations sur vos access keys.

Créer une access key avec Cockpit v2

  1. Dans le coin supérieur droit, cliquez sur l’icône IconProfil.
    Un menu déroulant apparaît.

  2. Cliquez sur IconUserKey Access keys.
    La liste de vos access keys apparaît.

  3. Cliquez sur IconAddFull Créer une access key.
    La boîte de dialogue CRÉER UNE ACCESS KEY apparaît.

  4. (optionnel) Appliquez une date d’expiration.

    Il est de bonne pratique d’appliquer une date d’expiration et de renouveler votre access key régulièrement.

  5. Cliquez sur Créer.
    Votre access key est créée.

  6. Cliquez sur IconCopy pour copier l’access key ou la secret key, ou cliquez sur IconImport Télécharger pour télécharger un fichier contenant la secret key.

    Pour des raisons de sécurité, la secret key est seulement disponible lorsque vous créez l’access key. Sauvegardez-la avec soin, car vous ne pourrez pas la retrouver ultérieurement.

Créer une access key avec OSC CLI

À ce jour, cette section est disponible en anglais uniquement.

The CreateAccessKey command creates an access key for either your root account or an EIM user. The new key is automatically set to ACTIVE.

For more information, see About Access Keys.

Request sample: Example with access key/secret key authentication
$ osc-cli api CreateAccessKey --profile "default" \
    --ExpirationDate "2063-04-05"
Request sample: Example with login/password authentication
$ osc-cli api CreateAccessKey --profile "default" --authentication-method "password" --login "$OSC_EMAIL" --password "$OSC_PASSWORD" \
    --ExpirationDate "2063-04-05"

This command contains the following attributes that you need to specify:

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • ExpirationDate: (optional) The date and time, or the date, at which you want the access key to expire, in ISO 8601 format (for example, 2020-06-14T00:00:00.000Z, or 2020-06-14). To remove an existing expiration date, use the method without specifying this parameter.

  • UserName: (optional) The name of the EIM user that owns the key to be created. If you do not specify a user name, this action creates an access key for the user who sends the request (which can be the root account).

The CreateAccessKey command returns the following elements:

  • AccessKey: Information about the access key.

    • AccessKeyId: The ID of the access key.

    • CreationDate: The date and time (UTC) at which the access key was created.

    • ExpirationDate: The date and time (UTC) at which the access key expires.

    • LastModificationDate: The date and time (UTC) at which the access key was last modified.

    • SecretKey: The secret key that enables you to send requests.

    • State: The state of the access key (ACTIVE if the key is valid for API calls, or INACTIVE if not).

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

Result sample
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  },
  "AccessKey": {
    "State": "ACTIVE",
    "AccessKeyId": "ABCDEFGHIJ0123456789",
    "CreationDate": "2010-10-01T12:34:56.789+0000",
    "ExpirationDate": "2063-04-05T00:00:00.000+0000",
    "SecretKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "LastModificationDate": "2010-10-01T12:34:56.789+0000"
  }
}

Créer une access key avec oapi-cli

À ce jour, cette section est disponible en anglais uniquement.

The CreateAccessKey command creates an access key for either your root account or an EIM user. The new key is automatically set to ACTIVE.

For more information, see About Access Keys.

Request sample: Example with access key/secret key authentication
$ oapi-cli --profile "default" CreateAccessKey \
    --ExpirationDate "2063-04-05"
Request sample: Example with login/password authentication
$ oapi-cli --profile "default" --login "$OSC_EMAIL" --password "$OSC_PASSWORD" CreateAccessKey \
    --ExpirationDate "2063-04-05"

This command contains the following attributes that you need to specify:

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • ExpirationDate: (optional) The date and time, or the date, at which you want the access key to expire, in ISO 8601 format (for example, 2020-06-14T00:00:00.000Z, or 2020-06-14). To remove an existing expiration date, use the method without specifying this parameter.

  • UserName: (optional) The name of the EIM user that owns the key to be created. If you do not specify a user name, this action creates an access key for the user who sends the request (which can be the root account).

The CreateAccessKey command returns the following elements:

  • AccessKey: Information about the access key.

    • AccessKeyId: The ID of the access key.

    • CreationDate: The date and time (UTC) at which the access key was created.

    • ExpirationDate: The date and time (UTC) at which the access key expires.

    • LastModificationDate: The date and time (UTC) at which the access key was last modified.

    • SecretKey: The secret key that enables you to send requests.

    • State: The state of the access key (ACTIVE if the key is valid for API calls, or INACTIVE if not).

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

Result sample
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  },
  "AccessKey": {
    "State": "ACTIVE",
    "AccessKeyId": "ABCDEFGHIJ0123456789",
    "CreationDate": "2010-10-01T12:34:56.789+0000",
    "ExpirationDate": "2063-04-05T00:00:00.000+0000",
    "SecretKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "LastModificationDate": "2010-10-01T12:34:56.789+0000"
  }
}

Pages connexes

Méthodes API correspondantes