-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[V2] Replaced /MyBucket/ with amzn-s3-demo-bucket (#9243)
- Loading branch information
1 parent
c560b1c
commit b887216
Showing
5 changed files
with
18 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
This example grants ``full control`` to two AWS users (*[email protected]* and *[email protected]*) and ``read`` | ||
permission to everyone:: | ||
|
||
aws s3api put-bucket-acl --bucket MyBucket --grant-full-control [email protected],[email protected] --grant-read uri=http://acs.amazonaws.com/groups/global/AllUsers | ||
aws s3api put-bucket-acl --bucket amzn-s3-demo-bucket --grant-full-control [email protected],[email protected] --grant-read uri=http://acs.amazonaws.com/groups/global/AllUsers | ||
|
||
See http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTacl.html for details on custom ACLs (the s3api ACL | ||
commands, such as ``put-bucket-acl``, use the same shorthand argument notation). | ||
|
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
**Example 1: To set bucket policy logging** | ||
|
||
The following ``put-bucket-logging`` example sets the logging policy for *MyBucket*. First, grant the logging service principal permission in your bucket policy using the ``put-bucket-policy`` command. :: | ||
The following ``put-bucket-logging`` example sets the logging policy for *amzn-s3-demo-bucket*. First, grant the logging service principal permission in your bucket policy using the ``put-bucket-policy`` command. :: | ||
|
||
aws s3api put-bucket-policy \ | ||
--bucket MyBucket \ | ||
--bucket amzn-s3-demo-bucket \ | ||
--policy file://policy.json | ||
|
||
Contents of ``policy.json``:: | ||
|
@@ -16,7 +16,7 @@ Contents of ``policy.json``:: | |
"Effect": "Allow", | ||
"Principal": {"Service": "logging.s3.amazonaws.com"}, | ||
"Action": "s3:PutObject", | ||
"Resource": "arn:aws:s3:::MyBucket/Logs/*", | ||
"Resource": "arn:aws:s3:::amzn-s3-demo-bucket/Logs/*", | ||
"Condition": { | ||
"ArnLike": {"aws:SourceARN": "arn:aws:s3:::SOURCE-BUCKET-NAME"}, | ||
"StringEquals": {"aws:SourceAccount": "SOURCE-AWS-ACCOUNT-ID"} | ||
|
@@ -28,14 +28,14 @@ Contents of ``policy.json``:: | |
To apply the logging policy, use ``put-bucket-logging``. :: | ||
|
||
aws s3api put-bucket-logging \ | ||
--bucket MyBucket \ | ||
--bucket amzn-s3-demo-bucket \ | ||
--bucket-logging-status file://logging.json | ||
|
||
Contents of ``logging.json``:: | ||
|
||
{ | ||
"LoggingEnabled": { | ||
"TargetBucket": "MyBucket", | ||
"TargetBucket": "amzn-s3-demo-bucket", | ||
"TargetPrefix": "Logs/" | ||
} | ||
} | ||
|
@@ -46,26 +46,26 @@ For more information, see `Amazon S3 Server Access Logging <https://docs.aws.ama | |
|
||
**Example 2: To set a bucket policy for logging access to only a single user** | ||
|
||
The following ``put-bucket-logging`` example sets the logging policy for *MyBucket*. The AWS user *[email protected]* will have full control over | ||
The following ``put-bucket-logging`` example sets the logging policy for *amzn-s3-demo-bucket*. The AWS user *[email protected]* will have full control over | ||
the log files, and no one else has any access. First, grant S3 permission with ``put-bucket-acl``. :: | ||
|
||
aws s3api put-bucket-acl \ | ||
--bucket MyBucket \ | ||
--bucket amzn-s3-demo-bucket \ | ||
--grant-write URI=http://acs.amazonaws.com/groups/s3/LogDelivery \ | ||
--grant-read-acp URI=http://acs.amazonaws.com/groups/s3/LogDelivery | ||
|
||
Then apply the logging policy using ``put-bucket-logging``. :: | ||
|
||
aws s3api put-bucket-logging \ | ||
--bucket MyBucket \ | ||
--bucket amzn-s3-demo-bucket \ | ||
--bucket-logging-status file://logging.json | ||
|
||
Contents of ``logging.json``:: | ||
|
||
{ | ||
"LoggingEnabled": { | ||
"TargetBucket": "MyBucket", | ||
"TargetPrefix": "MyBucketLogs/", | ||
"TargetBucket": "amzn-s3-demo-bucket", | ||
"TargetPrefix": "amzn-s3-demo-bucket-logs/", | ||
"TargetGrants": [ | ||
{ | ||
"Grantee": { | ||
|
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
The following command grants ``full control`` to two AWS users (*[email protected]* and *[email protected]*) and ``read`` | ||
permission to everyone:: | ||
|
||
aws s3api put-object-acl --bucket MyBucket --key file.txt --grant-full-control [email protected],[email protected] --grant-read uri=http://acs.amazonaws.com/groups/global/AllUsers | ||
aws s3api put-object-acl --bucket amzn-s3-demo-bucket --key file.txt --grant-full-control [email protected],[email protected] --grant-read uri=http://acs.amazonaws.com/groups/global/AllUsers | ||
|
||
See http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTacl.html for details on custom ACLs (the s3api ACL | ||
commands, such as ``put-object-acl``, use the same shorthand argument notation). |