Skip to content

Commit

Permalink
Merge pull request #999 from bisdavid/dtb-s3
Browse files Browse the repository at this point in the history
Added required minimum documentation and a bunch of refactoring
  • Loading branch information
Doug-AWS committed Feb 22, 2020
2 parents 8710626 + 9e856fb commit 43faf56
Show file tree
Hide file tree
Showing 10 changed files with 492 additions and 344 deletions.
52 changes: 52 additions & 0 deletions aws-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!--
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
This file is licensed under the Apache License, Version 2.0 (the "License").
You may not use this file except in compliance with the License. A copy of
the License is located at http://aws.amazon.com/apache2.0/.
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
-->
# AWS CLI examples

These are examples for the AWS Command Line Interface (AWS CLI) public
documentation. All examples have been tested and verified to work with
the AWS CLI version 2.

## Prerequisites

To run these examples, you'll need:

* The AWS CLI, downloaded and running on your machine
* AWS credentials in a shared credentials file

## Running the examples

Examples are typically written as functions in shell script files that can be
sourced from other files. Most are accompanied by a unit or integration test
script that you can run to validate that each example works. The test scripts
include setup and teardown to create and destroy any prerequisite resources.
We take care that all AWS resources that the example creates are also destroyed
to avoid incurring any unwanted costs. When you're done with an example, we do
recommend that you check the resources in your account to ensure that the
teardown worked as expected and didn't accidentally leave any resources behind.

To run the examples, you need to create a shared credentials file. For more
information about how to set up a shared credentials file, see [Configuration
and Credential File Settings](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html)
in the _AWS CLI User Guide_.

## AWS CLI downloads

For information about how to download and install the AWS CLI, see [Installing
the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html)
in the _AWS CLI User Guide_.

## Documentation

For detailed documentation for the AWS CLI, see the following:

* [AWS CLI User Guide](https://docs.aws.amazon.com/cli/latest/userguide/)
* [AWS CLI Reference Guide](https://docs.aws.amazon.com/cli/latest/reference/)
64 changes: 0 additions & 64 deletions aws-cli/README.rst

This file was deleted.

54 changes: 54 additions & 0 deletions aws-cli/bash-linux/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<!--
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
This file is licensed under the Apache License, Version 2.0 (the "License").
You may not use this file except in compliance with the License. A copy of
the License is located at http://aws.amazon.com/apache2.0/.
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
-->

# AWS CLI examples for BASH shell on Linux

These are examples for the AWS Command Line Interface (CLI) public
documentation. All examples have been tested and verified to work with AWS CLI
version 2. The testing platforms include Amazon Linux 2 and MacOS 10.14, both
using a BASH shell.

## Prerequisites

To run these examples, you need:

* The AWS CLI, downloaded and running on your machine
* AWS credentials in a shared credentials file

## Running the examples

Examples are typically written as functions in shell script files that can be
sourced from other files. Most are accompanied by a unit or integration test
script that you can run to validate that each example works. The test scripts
include setup and teardown to create and destroy any prerequisite resources.
We take care that all AWS resources that the example creates are also destroyed
to avoid incurring any unwanted costs. When you're done with an example, we do
recommend that you check the resources in your account to ensure that the
teardown worked as expected and didn't accidentally leave any resources behind.

To run the examples, you need to create a shared credentials file. For more
information about how to set up a shared credentials file, see [Configuration
and Credential File Settings](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html)
in the _AWS CLI User Guide_.

## AWS CLI downloads

For information about how to download and install the AWS CLI, see [Installing
the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html)
in the _AWS CLI User Guide_.

## Documentation

For detailed documentation for the AWS CLI, see the following:

* [AWS CLI User Guide](https://docs.aws.amazon.com/cli/latest/userguide/)
* [AWS CLI Reference Guide](https://docs.aws.amazon.com/cli/latest/reference/)
63 changes: 0 additions & 63 deletions aws-cli/bash-linux/README.rst

This file was deleted.

49 changes: 49 additions & 0 deletions aws-cli/bash-linux/s3/bucket-lifecycle-operations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!--
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
This file is licensed under the Apache License, Version 2.0 (the "License").
You may not use this file except in compliance with the License. A copy of
the License is located at http://aws.amazon.com/apache2.0/.
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
-->

# Amazon S3 Bucket Lifecycle Operations

This example demonstrates how to interact with some of the basic Amazon S3 operations.

## Files
* bucket-operations.sh - main script example file
* bucket-operations-test.sh - unit/integration test file
* general.sh - common test support function file

## Purpose
The main script file includes functions that perform the following tasks:

* Creating a bucket and verifying that it exists
* Copying a file from the local computer to a bucket
* Copying a file from one bucket location to a different bucket location
* Listing the contents of a bucket
* Deleting a file from a bucket
* Deleting a bucket

## Prerequisites

* An Amazon Web Services (AWS) account.
* A shared credentials file with a default profile. The profile that you use must have permissions that allow the AWS operations performed by the script. For more information about how to set up a shared credentials file, see [Configuration and Credential File Settings](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) in the _AWS CLI User Guide_.

## Running the Code

This example is written as a set of functions in a shell script file (bucket-operations.sh) that can be sourced from another file. The file *`bucket-operations-test.sh`* script demonstrates how to call the functions by sourcing the *`bucket-operations.sh`* file and calling each of the functions.

If all steps work correctly, the test script removes all resources that it created.

To see the intermediate results of each step, run the script with a `-i` parameter. When run this way, you can view the current status of the bucket or its contents using the Amazon S3 console. The script only proceeds to the next step when you press *ENTER* at the prompt.

## Additional Information

* As an AWS best practice, grant this code least privilege, or only the permissions required to perform a task. For more information, see [Grant Least Privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege) in the _AWS Identity and Access Management (IAM) User Guide_.
* This code has not been tested in all AWS Regions. Some AWS services are available only in specific Regions. For more information, see [Service Endpoints and Quotas](https://docs.aws.amazon.com/general/latest/gr/aws-service-information.html) in the _AWS General Reference Guide_.
* Running this code can result in charges to your AWS account. It is your responsibility to ensure that any resources created by this script are removed when you are done with them.
52 changes: 0 additions & 52 deletions aws-cli/bash-linux/s3/bucket-lifecycle-operations/README.rst

This file was deleted.

Loading

0 comments on commit 43faf56

Please sign in to comment.