forked from awsdocs/aws-doc-sdk-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.NET v3: Add the S3 Object Lock Workflow Scenario (awsdocs#6179)
- Loading branch information
Showing
15 changed files
with
1,817 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Amazon S3 Object Lock Workflow | ||
|
||
## Overview | ||
|
||
This example shows how to use AWS SDKs to work with Amazon Simple Storage Service (Amazon S3) object locking features. The workflow demonstrates how to create, update, view, and modify object locks, as well as how locked objects behave regarding requests to delete and overwrite. | ||
|
||
[Amazon S3 Object Lock](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock.html) can help prevent Amazon S3 objects from being deleted or overwritten for a fixed amount of time or indefinitely. Object Lock can help meet regulatory requirements or protect against object changes or deletion. | ||
|
||
![Object Lock Features](../../../../workflows/s3_object_lock/resources/Diagram_Amazon-S3-Object-Lock.png) | ||
|
||
This workflow demonstrates the following steps and tasks: | ||
1. Add object lock settings to both new and existing S3 buckets. | ||
1. Add objects to buckets with optional object lock or retention period settings. | ||
2. Attempt to delete or overwrite locked objects. | ||
3. Retrieve and view the object lock and retention period settings of buckets and objects. | ||
4. Delete the objects and buckets. | ||
1. Remove any object locks and use the BypassGovernanceRetention setting. | ||
|
||
## ⚠ Important | ||
|
||
* Running this code might result in charges to your AWS account. | ||
* 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](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege). | ||
* This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services). | ||
|
||
## Scenario | ||
|
||
### Prerequisites | ||
|
||
For general prerequisites, see the [README](../../../README.md) in the `dotnetv3` folder. | ||
|
||
### Resources | ||
|
||
The workflow scenario steps create the buckets and objects needed for the example. No additional resources are required. | ||
|
||
This workflow includes an optional step to add a governance mode retention period of one day to objects in an S3 bucket. In order to delete these objects, you must have the `s3:BypassGovernanceRetention` permission. If you do not have this permission, you will be unable to delete these objects until the retention period has expired. | ||
|
||
### Instructions | ||
|
||
After the example compiles, you can run it from the command line. To do so, navigate to | ||
the folder that contains the .sln file and run the following command: | ||
|
||
``` | ||
dotnet run | ||
``` | ||
|
||
Alternatively, you can run the example from within your IDE. | ||
|
||
This starts an interactive scenario that walks you through creating, exploring, and deleting S3 buckets and objects with various object lock settings. | ||
|
||
## Additional resources | ||
|
||
- [S3 Object Lock](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock.html) | ||
|
||
--- | ||
|
||
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 |
31 changes: 31 additions & 0 deletions
31
dotnetv3/S3/scenarios/S3ObjectLockScenario/S3ObjectLockScenario.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.7.34221.43 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "S3ObjectLockScenario", "S3ObjectLockWorkflow\S3ObjectLockScenario.csproj", "{AD5B04A6-0ED1-4384-9125-2E64B7898B52}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "S3ObjectLockTests", "S3ObjectLockTests\S3ObjectLockTests.csproj", "{9E2CFE55-8998-44D2-8331-93AAE8554677}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{AD5B04A6-0ED1-4384-9125-2E64B7898B52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{AD5B04A6-0ED1-4384-9125-2E64B7898B52}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{AD5B04A6-0ED1-4384-9125-2E64B7898B52}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{AD5B04A6-0ED1-4384-9125-2E64B7898B52}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{9E2CFE55-8998-44D2-8331-93AAE8554677}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{9E2CFE55-8998-44D2-8331-93AAE8554677}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{9E2CFE55-8998-44D2-8331-93AAE8554677}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{9E2CFE55-8998-44D2-8331-93AAE8554677}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {E2318334-46A6-4814-892D-EE6AE0307BEC} | ||
EndGlobalSection | ||
EndGlobal |
Oops, something went wrong.