### Quick Start with AWSS3.jl Source: https://github.com/juliacloud/awss3.jl/blob/master/docs/src/index.md Demonstrates basic S3 operations like creating a bucket, enabling versioning, and putting/getting objects. Requires AWSS3 and AWS packages. ```julia using AWSS3 using AWS # for `global_aws_config` aws = global_aws_config(; region="us-east-2") # pass keyword arguments to change defaults s3_create_bucket(aws, "my.bucket") s3_enable_versioning(aws, "my.bucket") s3_put(aws, "my.bucket", "key", "Hello!") println(s3_get(aws, "my.bucket", "key")) # prints "Hello!" println(s3_get(aws, "my.bucket", "key", byte_range=1:2)) # prints only "He" ``` -------------------------------- ### Using S3Path for Filesystem-like Operations Source: https://github.com/juliacloud/awss3.jl/blob/master/docs/src/index.md Illustrates how to use the S3Path object to interact with S3 as if it were a local filesystem. Supports operations like reading directories, joining paths, getting file stats, reading file content (full or byte range), and deleting files. Requires AWSS3, AWS, and FilePathsBase packages. ```julia julia> using AWSS3, AWS, FilePathsBase; # global_aws_config() is also the default if no `config` argument is passed julia> p = S3Path("s3://bucket-name/dir1/", config=global_aws_config()); julia> readdir(p) 1-element Vector{SubString{String}}: "demo.txt" julia> file = joinpath(p, "demo.txt") p"s3://bucket-name/dir1/demo.txt" julia> stat(file) Status( device = 0, inode = 0, mode = -rw-rw-rw-, nlink = 0, uid = 1000 (username), gid = 1000 (username), rdev = 0, size = 34 (34.0), blksize = 4096 (4.0K), blocks = 1, mtime = 2021-01-30T18:53:02, ctime = 2021-01-30T18:53:02, ) julia> String(read(file)) # fetch the file into memory "this is a file for testing S3Path\n" julia> String(read(file, byte_range=1:4)) # fetch a specific byte range of the file "this" julia> rm(file) # delete the file UInt8[] ``` -------------------------------- ### Initialize AWS Configuration and Interact with S3 Buckets Source: https://github.com/juliacloud/awss3.jl/blob/master/README.md Demonstrates how to set up AWS configuration with a specific region and perform basic S3 bucket operations like creation and deletion. If the configuration is omitted, it defaults to inferring from AWS.jl. ```julia using AWSS3 using AWS # for `global_aws_config` aws = global_aws_config(; region="us-east-2") # pass keyword arguments to change defaults s3_create_bucket(aws, "my.bucket") # if the config is omitted it will try to infer it as usual from AWS.jl s3_delete_bucket("my.bucket") ``` -------------------------------- ### File Operations with S3Path Source: https://github.com/juliacloud/awss3.jl/blob/master/README.md Illustrates how to use the S3Path object for filesystem-like operations on S3, including writing data, reading specific byte ranges, and controlling the return type of write operations. ```julia p = S3Path("s3://my.bucket/test1.txt") # provides an filesystem-like interface write(p, "some data") read(p, byte_range=1:4) # returns b"some" response = write(p, "other data"; returns=:response) # returns the raw `AWS.Response` on writing to S3 parsed_response = write(p, "other data"; returns=:parsed) # returns the parsed `AWS.Response` (default) versioned_path = write(p, "other data"; returns=:path) # returns the `S3Path` written to S3, including the version ID ``` -------------------------------- ### S3 Interaction Functions Source: https://github.com/juliacloud/awss3.jl/blob/master/docs/src/api.md Provides a set of functions for direct interaction with AWS S3, allowing users to perform various operations on buckets and objects. ```APIDOC ## S3 Interaction This section details the functions available for interacting with AWS S3. ### `s3_arn` **Description**: Get the ARN for an S3 bucket or object. ### `s3_get` **Description**: Get an S3 object. ### `s3_get_file` **Description**: Get an S3 object to a local file. ### `s3_get_meta` **Description**: Get S3 object metadata. ### `s3_exists` **Description**: Check if an S3 object exists. ### `s3_delete` **Description**: Delete an S3 object. ### `s3_copy` **Description**: Copy an S3 object. ### `s3_create_bucket` **Description**: Create an S3 bucket. ### `s3_put_cors` **Description**: Configure CORS for an S3 bucket. ### `s3_enable_versioning` **Description**: Enable versioning for an S3 bucket. ### `s3_put_tags` **Description**: Add or update tags for an S3 object. ### `s3_get_tags` **Description**: Get tags for an S3 object. ### `s3_delete_tags` **Description**: Delete tags for an S3 object. ### `s3_delete_bucket` **Description**: Delete an S3 bucket. ### `s3_list_buckets` **Description**: List all S3 buckets. ### `s3_list_objects` **Description**: List objects in an S3 bucket. ### `s3_list_keys` **Description**: List keys (object names) in an S3 bucket. ### `s3_purge_versions` **Description**: Purge all versions of an object in an S3 bucket. ### `s3_put` **Description**: Put an S3 object. ### `s3_sign_url` **Description**: Generate a pre-signed URL for an S3 object. ### `s3_nuke_bucket` **Description**: Delete all objects and versions in an S3 bucket and then delete the bucket. ``` -------------------------------- ### S3Path Interface Source: https://github.com/juliacloud/awss3.jl/blob/master/docs/src/api.md Details the `S3Path` type and its associated methods, which implements the `AbstractPath` interface for S3. ```APIDOC ## `S3Path` `S3Path` implements the `AbstractPath` interface. Refer to [FilePathsBase.jl documentation](https://rofinn.github.io/FilePathsBase.jl/stable/api/) for interface details. ### `S3Path` **Description**: Constructor for `S3Path`. ### `stat` **Description**: Get file status for an S3 object. ### `mkdir` **Description**: Create a directory (prefix) in S3. ### `read` **Description**: Read the content of an S3 object. ### `get_config` **Description**: Get the S3 configuration for a given path. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.