Complete the code to create an S3 bucket using AWS CLI.
aws s3api create-bucket --bucket [1] --region us-east-1
The --bucket option requires the bucket name. Here, you provide a unique bucket name like my-unique-bucket-123.
Complete the code to upload a file to an S3 bucket using AWS CLI.
aws s3 cp ./photo.jpg s3://[1]/The command uploads photo.jpg to the specified bucket. You must provide the bucket name after s3://.
Fix the error in the command to list objects in an S3 bucket.
aws s3api list-objects --bucket [1]The --bucket option requires the bucket name to list its objects. Here, my-bucket is the correct bucket name.
Fill both blanks to configure an S3 bucket policy that allows public read access.
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "[1]",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::[2]/*"
}]
}To allow public read access, the Effect must be Allow, and the Resource must specify the bucket name with /* to cover all objects.
Fill all three blanks to create a lifecycle rule that transitions objects to Glacier after 30 days and expires them after 365 days.
{
"Rules": [{
"ID": "ArchiveAndExpire",
"Status": "[1]",
"Filter": {},
"Transitions": [{
"Days": [2],
"StorageClass": "[3]"
}],
"Expiration": {
"Days": 365
}
}]
}The lifecycle rule must be Enabled to work. Objects transition after 30 days to the GLACIER storage class, and expire after 365 days.