Back to Aws Doc Sdk Examples

Amazon S3 Conditional Requests Feature Scenario for the SDK for JavaScript (v3)

javascriptv3/example_code/s3/scenarios/conditional-requests/README.md

latest2.6 KB
Original Source

Amazon S3 Conditional Requests Feature Scenario for the SDK for JavaScript (v3)

Overview

This example demonstrates how to use the AWS SDK for JavaScript (v3) to work with Amazon Simple Storage Service (Amazon S3) conditional request features. The scenario demonstrates how to add preconditions to S3 operations, and how those operations will succeed or fail based on the conditional requests.

Amazon S3 Conditional Requests are used to add preconditions to S3 read, copy, or write requests.

⚠ Important

  • Running this code might result in charges to your AWS account. For more details, see AWS Pricing and Free Tier.
  • Running the tests might result in charges to your AWS account.
  • We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see Grant least privilege.
  • This code is not tested in every AWS Region. For more information, see AWS Regional Services.

Code examples

Prerequisites

For prerequisites, see the README in the javascriptv3 folder.

Scenarios

This example uses a feature scenario to demonstrate various aspects of S3 conditional requests. The scenario is divided into three stages:

  1. Deploy: Create test buckets and objects.
  2. Demo: Explore S3 conditional requests by listing objects, attempting to read or write with conditional requests, and viewing request results.
  3. Clean: Delete all objects and buckets.

Deploy Stage

bash
node index.js -s deploy

Demo Stage

bash
node index.js -s demo

Clean Stage

bash
node index.js -s clean

Tests

⚠ Running tests might result in charges to your AWS account.

To find instructions for running these tests, see the README in the javascriptv3 folder.

Additional resources


Copyright Amazon.com, Inc. or its cd ..affiliates. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0