Amazon-S3-Lite
view release on metacpan or search on metacpan
share/README.md view on Meta::CPAN
{ name => 'my-bucket', creation_date => '2024-01-01T00:00:00.000Z' },
{ name => 'other-bucket', creation_date => '2024-06-01T00:00:00.000Z' },
...
],
}
Note that this operation is always signed against `us-east-1`
regardless of the region the object was constructed with. See
["LAMBDA USAGE NOTES"](#lambda-usage-notes).
## create\_bucket
$s3->create_bucket($bucket);
$s3->create_bucket($bucket, region => 'eu-west-1', acl => 'private');
Creates a new S3 bucket. Options:
- region
The region in which to create the bucket. Defaults to the region the
object was constructed with. **Note:** `us-east-1` is S3's implicit
default - the `CreateBucketConfiguration` body is intentionally
omitted for that region as including it causes a `InvalidLocationConstraint`
error. For all other regions the `LocationConstraint` element is
sent automatically.
- acl
Canned ACL string, e.g. `private` (the S3 default), `public-read`.
Returns true on success. Croaks on failure.
## delete\_bucket
$s3->delete_bucket($bucket);
$s3->delete_bucket($bucket, region => 'us-west-2');
Deletes an empty bucket. Returns a true value on success. S3 refuses
to delete a bucket that still contains objects, so callers must empty
the bucket first (for example by iterating ["list\_all\_objects\_v2"](#list_all_objects_v2) and
calling ["delete\_object"](#delete_object) on each key).
- region
Override the region the delete is signed against. Defaults to the
region the object was constructed with.
## put\_public\_access\_block
$s3->put_public_access_block($bucket);
$s3->put_public_access_block(
$bucket,
block_public_acls => 1,
ignore_public_acls => 1,
block_public_policy => 0,
restrict_public_buckets => 0,
);
Sets the Block Public Access configuration on a bucket. Each of the
four settings is a boolean; any setting not supplied **defaults to
true** (fully locked down), so an argument-less call blocks all public
access. Returns a true value on success.
- block\_public\_acls
- ignore\_public\_acls
- block\_public\_policy
- restrict\_public\_buckets
Each accepts a true/false value. Omitted settings default to true.
Note that hosting content publicly (for example a static website, or
a policy-scoped private bucket that grants anonymous `GetObject` from
a VPC endpoint) requires the relevant setting to be false so the
bucket policy is not rejected.
## put\_bucket\_website
$s3->put_bucket_website($bucket);
$s3->put_bucket_website($bucket, index => 'index.html', error => 'error.html');
Configures the bucket as an S3 static website endpoint. Returns a true
value on success.
- index
The index document suffix. Defaults to `index.html`.
- error
The error document key. Optional; when omitted, no error document is
configured.
## get\_bucket\_website
my $config = $s3->get_bucket_website($bucket);
Returns the bucket's website configuration as a hashref, or `undef`
if the bucket has no website configuration. The hashref contains
whichever of the following are set:
- index\_document
The index document suffix.
- error\_document
The error document key.
- redirect\_all\_requests\_to
The hostname all requests are redirected to, if the bucket is
configured as a redirect.
## delete\_bucket\_website
$s3->delete_bucket_website($bucket);
Removes the website configuration from a bucket. Returns a true value
on success.
## put\_bucket\_policy
( run in 1.254 second using v1.01-cache-2.11-cpan-800906f7e73 )