Amazon-S3
view release on metacpan or search on metacpan
lib/Amazon/S3/CLI.pm view on Meta::CPAN
create-bucket Create a bucket
delete-key Delete an object
empty-bucket Empty a bucket
get-bucket-acl Retrieve a bucket ACL
get-bucket-policy Retrieve a bucket policy
get-bucket-policy-status Retrieve bucket policy status
get-key Retrieve an object
list-bucket-keys List objects
list-buckets List buckets
list-directory-buckets List directory buckets
list-object-versions List object versions
remove-bucket Remove a bucket
Use:
amzn-s3-cli --help
for command and option documentation.
=head1 DESCRIPTION
C<Amazon::S3::CLI> provides the C<amzn-s3-cli> command for performing
common Amazon S3 operations using L<Amazon::S3>.
It is intended as a convenient command-line companion to the library,
not as a replacement for the complete AWS CLI or C<aws s3api> command
surface.
The CLI supports common bucket and object operations and can also be
used with S3-compatible services by specifying an alternate endpoint.
=head2 Commands
=over
=item B<add-key>
amzn-s3-cli add-key bucket-name filename [object-name]
Adds a file to a bucket.
The bucket may alternatively be supplied with C<--bucket-name>. If
C<object-name> is omitted, the filename is used as the object key.
The content type may be supplied with C<--content-type>. Otherwise the
CLI attempts to determine the MIME type with L<File::MimeInfo::Magic>,
when installed, and falls back to C<application/octet-stream>.
=item B<copy-key>
amzn-s3-cli copy-key bucket-name key new-key
Copies an object to another key in the same bucket.
=item B<create-bucket>
amzn-s3-cli create-bucket bucket-name
Creates a bucket.
Use C<--region> to select a region other than C<us-east-1>.
C<--availability-zone> may be used to create an S3 Express One Zone
directory bucket.
=item B<delete-key>
amzn-s3-cli delete-key bucket-name key
Deletes an object.
Use C<--version-id> to delete a specific version from a versioned
bucket.
=item B<empty-bucket>
amzn-s3-cli empty-bucket bucket-name
Removes all object versions, delete markers, and incomplete multipart
uploads from a bucket.
The command prompts for confirmation before deleting data. Use
C<--force> to suppress the prompt.
=item B<get-bucket-acl>
amzn-s3-cli get-bucket-acl bucket-name
Retrieves the bucket ACL and emits the decoded result as JSON.
=item B<get-bucket-policy>
amzn-s3-cli get-bucket-policy bucket-name
Retrieves the bucket policy and emits it as formatted JSON.
=item B<get-bucket-policy-status>
amzn-s3-cli get-bucket-policy-status bucket-name
Retrieves the public-access status calculated from the bucket policy
and emits the decoded result as JSON.
=item B<get-key>
amzn-s3-cli get-key bucket-name key
Retrieves an object.
By default the object is written to a file using the basename of the
object key.
Use C<--output> to specify another filename or C<--output -> to write
the object to standard output.
Use C<--version-id> to retrieve a specific object version.
Use C<--range> to request a byte range and C<--modified-since> to add an
C<If-Modified-Since> condition.
=item B<list-bucket-keys>
lib/Amazon/S3/CLI.pm view on Meta::CPAN
=item B<--output>, B<-o>
Specifies where C<get-key> writes its result.
Use C<-> to write object data to standard output.
=item B<--prefix>
Limits object listing commands to keys beginning with the specified
prefix.
=item B<--profile>, B<-p>
Selects an AWS credential profile.
This option requires L<Amazon::Credentials>.
=item B<--range>, B<-R>
Requests a byte range with C<get-key>.
Specify only the range:
--range 0-1023
=item B<--region>, B<-r>
Specifies the AWS region.
The default is C<us-east-1>.
=item B<--secure>, B<-s>
Controls secure transport when host-based endpoint configuration is
used.
When C<--endpoint-url> is supplied, the URL scheme determines the
transport.
=item B<--version-id>
Specifies an object version ID for C<get-key> or C<delete-key>.
=back
=head1 AUTHENTICATION
If L<Amazon::Credentials> is installed, C<amzn-s3-cli> uses it for
credential discovery and supports named profiles:
amzn-s3-cli list-buckets --profile sandbox
Without L<Amazon::Credentials>, credentials are read from:
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_SESSION_TOKEN
=head1 S3-COMPATIBLE SERVICES
An alternate S3 endpoint may be selected with C<--endpoint-url>:
amzn-s3-cli list-buckets --endpoint-url http://localhost:4566 --profile localstack
This is useful for LocalStack and other S3-compatible services.
=head1 OPTIONAL DEPENDENCIES
=over
=item L<Amazon::Credentials>
Provides credential discovery and named profile support.
=item L<File::MimeInfo::Magic>
Provides MIME type detection for C<add-key>.
=item L<Text::ASCIITable>
Provides C<--format table> output.
=back
=head1 SEE ALSO
L<Amazon::S3>
L<Amazon::S3::Bucket>
L<Amazon::S3::BucketV2>
L<Amazon::Credentials>
=head1 LICENSE
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=head1 AUTHOR
Rob Lauer - E<lt>rlauer@treasurersbriefcase.comE<gt>
=cut
( run in 0.925 second using v1.01-cache-2.11-cpan-eca53f54451 )