How to use the command 'linode-cli object-storage' (with examples)

How to use the command 'linode-cli object-storage' (with examples)

The ’linode-cli object-storage’ command is used to manage Linode Object Storage. It provides a set of functionalities to create, delete and manage object storage buckets, as well as to list and manage access keys for object storage. This command is a part of Linode CLI, which is a command-line interface for managing Linode services.

Use case 1: List all Object Storage buckets

Code:

linode-cli object-storage buckets list

Motivation:

The motivation for listing all Object Storage buckets is to view all the available buckets in your Object Storage cluster. This can be useful to verify that all the buckets are created and to check their labels in order to identify them easily.

Explanation:

  • linode-cli object-storage: This is the main command to manage Linode Object Storage.
  • buckets: This sub-command is used to perform operations related to buckets.
  • list: This option is used to list all the buckets in the Object Storage cluster.

Example output:

[
    {
        "cluster": "us-east-1",
        "label": "mybucket1"
    },
    {
        "cluster": "us-east-1",
        "label": "mybucket2"
    }
]

Use case 2: Create a new Object Storage bucket

Code:

linode-cli object-storage buckets create --cluster us-east-1 --label mybucket3

Motivation:

The motivation for creating a new Object Storage bucket is to create a new storage space for storing objects. This can be useful when you need to organize your objects into different buckets based on their types or categories.

Explanation:

  • linode-cli object-storage: This is the main command to manage Linode Object Storage.
  • buckets: This sub-command is used to perform operations related to buckets.
  • create: This option is used to create a new bucket.
  • --cluster us-east-1: This argument specifies the cluster where the bucket will be created. In this example, the bucket will be created in the “us-east-1” cluster.
  • --label mybucket3: This argument specifies the label for the new bucket. In this example, the label is set to “mybucket3”.

Example output:

{
    "cluster": "us-east-1",
    "label": "mybucket3"
}

Use case 3: Delete an Object Storage bucket

Code:

linode-cli object-storage buckets delete us-east-1 mybucket2

Motivation:

The motivation for deleting an Object Storage bucket is to remove a bucket that is no longer needed or to clean up unused buckets. This can help in managing storage resources efficiently and decluttering the Object Storage cluster.

Explanation:

  • linode-cli object-storage: This is the main command to manage Linode Object Storage.
  • buckets: This sub-command is used to perform operations related to buckets.
  • delete: This option is used to delete a bucket.
  • us-east-1: This argument specifies the cluster where the bucket to be deleted is located.
  • mybucket2: This argument specifies the label of the bucket to be deleted.

Example output:

{
    "cluster": "us-east-1",
    "label": "mybucket2"
}

Use case 4: List Object Storage cluster regions

Code:

linode-cli object-storage clusters list

Motivation:

The motivation for listing Object Storage cluster regions is to view all the available regions where Object Storage clusters can be created. This can be useful when choosing the appropriate region for creating new buckets or managing existing clusters.

Explanation:

  • linode-cli object-storage: This is the main command to manage Linode Object Storage.
  • clusters: This sub-command is used to perform operations related to clusters.
  • list: This option is used to list all the available cluster regions.

Example output:

[
    {
        "id": "us-east-1",
        "status": "available",
        "domain": "us-east-1.linodeobjects.com"
    },
    {
        "id": "us-west-1",
        "status": "available",
        "domain": "us-west-1.linodeobjects.com"
    }
]

Use case 5: List access keys for Object Storage

Code:

linode-cli object-storage keys list

Motivation:

The motivation for listing access keys for Object Storage is to view all the access keys associated with your Object Storage cluster. This can be useful for managing access to the cluster and ensuring that only authorized users have access to the storage.

Explanation:

  • linode-cli object-storage: This is the main command to manage Linode Object Storage.
  • keys: This sub-command is used to perform operations related to access keys.
  • list: This option is used to list all the access keys in the Object Storage cluster.

Example output:

[
    {
        "id": "12345678-abcdef",
        "label": "Key 1",
        "created": "2021-01-01T00:00:00",
        "last_used": "2021-02-01T00:00:00"
    },
    {
        "id": "7890abcd-efgh",
        "label": "Key 2",
        "created": "2021-02-01T00:00:00",
        "last_used": null
    }
]

Use case 6: Create a new access key for Object Storage

Code:

linode-cli object-storage keys create --label Key3

Motivation:

The motivation for creating a new access key for Object Storage is to generate a new set of credentials that can be used to access the Object Storage cluster. This can be useful when you need to provide access to a new user or revoke access for an existing user.

Explanation:

  • linode-cli object-storage: This is the main command to manage Linode Object Storage.
  • keys: This sub-command is used to perform operations related to access keys.
  • create: This option is used to create a new access key.
  • --label Key3: This argument specifies the label for the new access key. In this example, the label is set to “Key3”.

Example output:

{
    "id": "ijklmnop-qrst",
    "label": "Key3",
    "created": "2021-03-01T00:00:00",
    "last_used": null
}

Use case 7: Revoke an access key for Object Storage

Code:

linode-cli object-storage keys revoke 12345678-abcdef

Motivation:

The motivation for revoking an access key for Object Storage is to deactivate a specific access key and prevent it from being used to access the Object Storage cluster. This can be useful when a user no longer requires access or when an access key is compromised.

Explanation:

  • linode-cli object-storage: This is the main command to manage Linode Object Storage.
  • keys: This sub-command is used to perform operations related to access keys.
  • revoke: This option is used to revoke an access key.
  • 12345678-abcdef: This argument specifies the access key ID to be revoked.

Example output:

{
    "id": "12345678-abcdef",
    "label": "Key 1",
    "created": "2021-01-01T00:00:00",
    "last_used": "2021-02-01T00:00:00"
}

Conclusion:

The ’linode-cli object-storage’ command provides a comprehensive set of functionalities to manage Linode Object Storage. With this command, you can easily create, delete, and manage buckets, as well as generate and revoke access keys. These functionalities are essential for organizing and securing your objects in the Object Storage cluster, ensuring efficient storage management, and granting access to authorized users.

Related Posts

How to use the command 'go run' (with examples)

How to use the command 'go run' (with examples)

The go run command is used to compile and run Go code without saving a binary.

Read More
How to use the command 'doskey' (with examples)

How to use the command 'doskey' (with examples)

The ‘doskey’ command is a Windows command-line tool that is used to manage macros, Windows commands, and command-lines.

Read More
How to use the command 'duf' (with examples)

How to use the command 'duf' (with examples)

The ‘duf’ command is a disk usage/free utility that provides information about disk usage.

Read More