Bird
Raised Fist0
AWScloud~20 mins

Creating S3 buckets in AWS - Practice Exercises

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
S3 Bucket Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Configuration
intermediate
2:00remaining
What is the output of this AWS CLI command?
You run the following AWS CLI command to create an S3 bucket in the us-east-1 region:

aws s3api create-bucket --bucket my-unique-bucket-12345 --region us-east-1

What will be the result?
AWS
aws s3api create-bucket --bucket my-unique-bucket-12345 --region us-east-1
ABucket is created but in the default region us-west-2.
BCommand fails because LocationConstraint must be set for us-east-1.
CBucket is created successfully without specifying LocationConstraint.
DCommand fails because bucket name is invalid.
Attempts:
2 left
💡 Hint
The us-east-1 region is special in AWS S3 bucket creation.
Architecture
intermediate
1:00remaining
How many buckets can you create in AWS by default?
By default, how many Amazon S3 buckets can you create in a single AWS account?
A1000 buckets
B100 buckets
CUnlimited buckets
D10 buckets
Attempts:
2 left
💡 Hint
Think about AWS default service limits.
security
advanced
3:00remaining
Which bucket policy option correctly denies public access?
You want to deny all public access to your S3 bucket named 'my-secure-bucket'. Which bucket policy snippet correctly denies any request that is not from your AWS account?
AWS
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Deny",
      "Principal": "*",
      "Action": "s3:*",
      "Resource": ["arn:aws:s3:::my-secure-bucket", "arn:aws:s3:::my-secure-bucket/*"],
      "Condition": {
        "StringNotEquals": {
          "aws:PrincipalAccount": "123456789012"
        }
      }
    }
  ]
}
AEffect: Allow, Principal: *, Condition: StringEquals aws:PrincipalAccount your-account-id
BEffect: Deny, Principal: *, Condition: StringNotEquals aws:PrincipalAccount your-account-id
CEffect: Deny, Principal: your-account-id, Condition: StringEquals aws:PrincipalAccount your-account-id
DEffect: Allow, Principal: *, no Condition
Attempts:
2 left
💡 Hint
Deny overrides allow and Principal * means everyone.
service_behavior
advanced
1:30remaining
What happens if you try to create an S3 bucket with a name already taken globally?
You attempt to create an S3 bucket named 'example-bucket' but this name is already used by another AWS user in a different region. What will happen?
ABucket creation fails with an error that the bucket name is already taken.
BBucket is created successfully in your region with the same name.
CBucket creation succeeds but is shared globally with the other user.
DAWS automatically appends a unique suffix to your bucket name and creates it.
Attempts:
2 left
💡 Hint
S3 bucket names must be unique across all AWS users worldwide.
Best Practice
expert
3:00remaining
Which bucket configuration best ensures data durability and availability across multiple regions?
You want to create an S3 bucket that stores data redundantly across multiple AWS regions to protect against regional failures. Which configuration achieves this?
AEnable S3 Transfer Acceleration on a single regional bucket.
BCreate a standard S3 bucket in one region with versioning enabled.
CCreate multiple buckets in different regions and manually copy data between them.
DUse S3 Cross-Region Replication (CRR) to replicate objects to a bucket in another region.
Attempts:
2 left
💡 Hint
Look for automated replication across regions.

Practice

(1/5)
1. What is the main purpose of an Amazon S3 bucket?
easy
A. To store and organize files in the cloud
B. To run virtual servers
C. To manage user permissions
D. To monitor network traffic

Solution

  1. Step 1: Understand what S3 buckets are

    S3 buckets are containers in the cloud used to store data like files and folders.
  2. Step 2: Identify the correct purpose

    Among the options, only storing and organizing files matches the bucket's role.
  3. Final Answer:

    To store and organize files in the cloud -> Option A
  4. Quick Check:

    S3 bucket = cloud storage container [OK]
Hint: Buckets are cloud folders for files, not servers or monitoring [OK]
Common Mistakes:
  • Confusing buckets with servers
  • Thinking buckets manage permissions directly
  • Assuming buckets monitor network
2. Which AWS CLI command correctly creates an S3 bucket named my-unique-bucket in the us-east-1 region?
easy
A. aws s3 create-bucket --bucket my-unique-bucket --region us-east-1
B. aws s3 mb my-unique-bucket --region us-east-1
C. aws s3api create-bucket --bucket my-unique-bucket --region us-east-1
D. aws s3api create-bucket --bucket my-unique-bucket --create-region us-east-1

Solution

  1. Step 1: Identify the correct AWS CLI syntax for creating buckets

    The aws s3api create-bucket command is the standard for bucket creation with region specification.
  2. Step 2: Check the region parameter correctness

    The correct parameter is --region, not --create-region. Also, aws s3 mb is shorthand but requires the bucket URL format.
  3. Final Answer:

    aws s3api create-bucket --bucket my-unique-bucket --region us-east-1 -> Option C
  4. Quick Check:

    Correct CLI syntax = aws s3api create-bucket --bucket my-unique-bucket --region us-east-1 [OK]
Hint: Use 'aws s3api create-bucket' with --region for bucket creation [OK]
Common Mistakes:
  • Using 'aws s3 mb' without s3:// prefix
  • Wrong parameter name like --create-region
  • Omitting the --region parameter
3. What will happen if you run this command?
aws s3api create-bucket --bucket my.bucket.name --region us-west-2
medium
A. Command fails due to missing ACL parameter
B. Bucket is created successfully in us-west-2
C. Bucket is created but in default region us-east-1
D. Error because bucket name contains dots and region requires special config

Solution

  1. Step 1: Understand bucket naming rules and region requirements

    Bucket names with dots require special handling in regions other than us-east-1 due to SSL certificate validation.
  2. Step 2: Analyze the command behavior

    Without specifying the --create-bucket-configuration for us-west-2, the command will fail because of the dot in the bucket name and region mismatch.
  3. Final Answer:

    Error because bucket name contains dots and region requires special config -> Option D
  4. Quick Check:

    Dots in bucket + region ≠ simple create [OK]
Hint: Buckets with dots need extra config outside us-east-1 [OK]
Common Mistakes:
  • Assuming bucket creates without error
  • Ignoring region-specific config for dots
  • Thinking ACL is mandatory for creation
4. You tried to create a bucket with this command:
aws s3api create-bucket --bucket 123_invalid_bucket --region us-east-1

But it failed. What is the most likely reason?
medium
A. Bucket name contains underscores which are invalid
B. Bucket name starts with numbers which is not allowed
C. Region us-east-1 does not support bucket creation
D. Missing --acl parameter causes failure

Solution

  1. Step 1: Review bucket naming rules

    Bucket names cannot contain underscores (_) but can start with numbers.
  2. Step 2: Check command and region validity

    Region us-east-1 supports bucket creation and --acl is optional, so failure is due to invalid underscore in name.
  3. Final Answer:

    Bucket name contains underscores which are invalid -> Option A
  4. Quick Check:

    Underscores not allowed in bucket names [OK]
Hint: Bucket names cannot have underscores, even if starting with numbers [OK]
Common Mistakes:
  • Thinking numbers can't start bucket names
  • Assuming region blocks creation
  • Believing --acl is required
5. You want to create an S3 bucket named my.bucket.name in eu-west-1 region using AWS CLI. Which command will work correctly?
hard
A. aws s3api create-bucket --bucket my.bucket.name --region eu-west-1
B. aws s3api create-bucket --bucket my.bucket.name --region eu-west-1 --create-bucket-configuration LocationConstraint=eu-west-1
C. aws s3api create-bucket --bucket my.bucket.name --region eu-west-1 --acl public-read
D. aws s3 mb s3://my.bucket.name --region eu-west-1

Solution

  1. Step 1: Understand bucket creation with dots in non-us-east-1 regions

    Bucket names with dots require specifying --create-bucket-configuration LocationConstraint for regions other than us-east-1.
  2. Step 2: Analyze each command option

    aws s3api create-bucket --bucket my.bucket.name --region eu-west-1 misses the configuration, so it fails. aws s3api create-bucket --bucket my.bucket.name --region eu-west-1 --create-bucket-configuration LocationConstraint=eu-west-1 correctly includes the LocationConstraint. aws s3api create-bucket --bucket my.bucket.name --region eu-west-1 --acl public-read adds ACL but misses LocationConstraint. aws s3 mb s3://my.bucket.name --region eu-west-1 uses shorthand but lacks configuration for dots.
  3. Final Answer:

    aws s3api create-bucket --bucket my.bucket.name --region eu-west-1 --create-bucket-configuration LocationConstraint=eu-west-1 -> Option B
  4. Quick Check:

    Dots + region ≠ no config; use LocationConstraint [OK]
Hint: Add LocationConstraint for buckets with dots outside us-east-1 [OK]
Common Mistakes:
  • Omitting LocationConstraint for regions with dots
  • Assuming ACL fixes creation errors
  • Using shorthand without config for dots