Bucket objects in Amazon Lightsail - Amazon Lightsail

Bucket objects in Amazon Lightsail

You can view all objects stored in your bucket in the Amazon Lightsail object storage service by using the Lightsail console. You can also use the AWS Command Line Interface (AWS CLI) and AWS SDKs to list object keys in your bucket. For more information about buckets, see Object storage.

Filter objects using the Lightsail console

Complete the following procedure to view objects stored in a bucket using the Lightsail console.

  1. Sign in to the Lightsail console.

  2. On the Lightsail home page, choose the Storage tab.

  3. Choose the name of the bucket for which you want to view objects.

  4. The Objects browser pane in the Objects tab displays the objects and folders that are stored in your bucket.

    
            The object browser pane in the Lightsail console
  5. Browse to the location of the object for which you want to view properties.

  6. Add a check mark next to the object for which you want to view properties.

  7. The Object properties pane on the right side of the page displays information about the object.

    
            The object properties pane in the Lightsail console

    The information displayed includes:

    1. Links to view and download the object.

    2. Actions menu (⋮) to copy or delete the object. For more information about copying and deleting objects, see Copy or move objects in a bucket in Amazon Lightsail and Delete bucket objects.

    3. Object size, and last modified timestamp.

    4. The access permission of the individual object, which could be private or public (read-only). For more information about object permissions, see Bucket permissions.

    5. The metadata of the object. The content type (ContentType) key is the only metadata supported by the Lightsail object storage service at this time.

    6. The object key value tags. For more information, see Tag bucket objects.

    7. The option to manage stored versions of the object. For more information, see Enable and suspend object versioning in a bucket.

    Note

    When you select multiple objects, the Object properties pane displays only the total size of the selected objects.

View objects using the AWS CLI

Complete the following procedure to list object keys in a bucket using the AWS Command Line Interface (AWS CLI). You do this by using the list-objects-v2 command. For more information, see list-objects-v2 in the AWS CLI Command Reference.

Note

You must install the AWS CLI and configure it for Lightsail and Amazon S3 before continuing with this procedure. For more information, see Configure the AWS Command Line Interface to work with Amazon Lightsail.

  1. Open a Command Prompt or Terminal window.

  2. Enter one of the following commands.

    • Enter the following command to list all object keys in your bucket.

      aws s3api list-objects-v2 --bucket BucketName --query "Contents[].{Key: Key, Size: Size}"

      In the command, replace BucketName with the name of the bucket for which you want to list all objects.

    • Enter the following command to list objects that start with a specific object key name prefix.

      aws s3api list-objects-v2 --bucket BucketName --prefix ObjectKeyNamePrefix --query "Contents[].{Key: Key, Size: Size}"

      In the command, replace the following example text with your own:

      • BucketName - The name of the bucket for which you want to list all objects.

      • ObjectKeyNamePrefix - An object key name prefix to limit the response to keys that begin with the specified prefix.

      Note

      These commands use the --query parameter to filter the response of the list-objects-v2 request to the key value and size of each object.

    Examples:

    Listing all object keys in a bucket:

    aws s3api list-objects-v2 --bucket DOC-EXAMPLE-BUCKET --query "Contents[].{Key: Key, Size: Size}"

    For the preceding command, you should see a result similar to the following example.

    
            Result of the AWS CLI list-objects-v2 command

    Listing object keys that start with the archived/ object key name prefix:

    aws s3api list-objects-v2 --bucket DOC-EXAMPLE-BUCKET --prefix archived/ --query "Contents[].{Key: Key, Size: Size}"

    For the preceding command, you should see a result similar to the following example.

    
            Result of the AWS CLI list-objects-v2 command

Manage buckets and objects

These are the general steps to manage your Lightsail object storage bucket:

  1. Learn about objects and buckets in the Amazon Lightsail object storage service. For more information, see Object storage in Amazon Lightsail.

  2. Learn about the names that you can give your buckets in Amazon Lightsail. For more information, see Bucket naming rules in Amazon Lightsail.

  3. Get started with the Lightsail object storage service by creating a bucket. For more information, see Creating buckets in Amazon Lightsail.

  4. Learn about security best practices for buckets and the access permissions that you can configure for your bucket. You can make all objects in your bucket public or private, or you can choose to make individual objects public. You can also grant access to your bucket by creating access keys, attaching instances to your bucket, and granting access to other AWS accounts. For more information, see Security Best Practices for Amazon Lightsail object storage and Understanding bucket permissions in Amazon Lightsail.

    After learning about bucket access permissions, see the following guides to grant access to your bucket:

  5. Learn how to enable access logging for your bucket, and how to use access logs to audit the security of your bucket. For more information, see the following guides.

  6. Create an IAM policy that grants a user the ability to manage a bucket in Lightsail. For more information, see IAM policy to manage buckets in Amazon Lightsail.

  7. Learn about the way that objects in your bucket are labeled and identified. For more information, see Understanding object key names in Amazon Lightsail.

  8. Learn how to upload files and manage objects in your buckets. For more information, see the following guides.

  9. Enable object versioning to preserve, retrieve, and restore every version of every object stored in your bucket. For more information, see Enabling and suspending object versioning in a bucket in Amazon Lightsail.

  10. After enabling object versioning, you can restore previous versions of objects in your bucket. For more information, see Restoring previous versions of objects in a bucket in Amazon Lightsail.

  11. Monitor the utilization of your bucket. For more information, see Viewing metrics for your bucket in Amazon Lightsail.

  12. Configure an alarm for bucket metrics to be notified when the utilization of your bucket crosses a threshold. For more information, see Creating bucket metric alarms in Amazon Lightsail.

  13. Change the storage plan of your bucket if it's running low on storage and network transfer. For more information, see Changing the plan of your bucket in Amazon Lightsail.

  14. Learn how to connect your bucket to other resources. For more information, see the following tutorials.

  15. Delete your bucket if you're no longer using it. For more information, see Deleting buckets in Amazon Lightsail.