Bird
Raised Fist0
AWScloud~20 mins

Resources section in AWS - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
CloudFormation Resources Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding AWS CloudFormation Resources Section
In AWS CloudFormation, what is the primary purpose of the Resources section in a template?
ATo set conditions that control whether certain resources are created.
BTo specify the output values that the stack will return after creation.
CTo declare parameters that users must input when launching the stack.
DTo define the AWS infrastructure components like EC2 instances, S3 buckets, and IAM roles that will be created or updated.
Attempts:
2 left
💡 Hint

Think about where you describe the actual AWS services you want to build.

❓ Configuration
intermediate
2:00remaining
Identifying a Valid Resource Definition in CloudFormation
Which of the following Resources section snippets will successfully create an S3 bucket with versioning enabled?
A
MyBucket:
  Type: AWS::S3::Bucket
  Properties:
    VersioningConfiguration:
      Status: Enabled
B
MyBucket:
  Type: AWS::S3::Bucket
  Properties:
    Versioning:
      Enabled: true
C
MyBucket:
  Type: AWS::S3::Bucket
  Properties:
    VersioningConfiguration:
      Status: True
D
MyBucket:
  Type: AWS::S3::Bucket
  Properties:
    VersioningConfiguration:
      State: Enabled
Attempts:
2 left
💡 Hint

Check the exact property names and values required by AWS for enabling versioning.

❓ Architecture
advanced
2:00remaining
Choosing the Correct Resource Dependency Configuration
You have two resources in your CloudFormation template: an EC2 instance and an EBS volume. The EC2 instance must be created only after the EBS volume is ready. Which resource property correctly enforces this dependency?
APlace the EC2 instance resource before the EBS volume resource in the template.
BUse the Condition section to create the EC2 instance only if the EBS volume exists.
CAdd a DependsOn attribute to the EC2 instance resource referencing the EBS volume resource name.
DSet the EBS volume's Properties to include the EC2 instance's ID.
Attempts:
2 left
💡 Hint

Think about how CloudFormation controls creation order explicitly.

❓ security
advanced
2:00remaining
Securing an IAM Role Resource in CloudFormation
Which of the following Resources section snippets correctly defines an IAM role with a policy that allows only read access to S3 buckets?
A
MyRole:
  Type: AWS::IAM::Role
  Properties:
    AssumeRolePolicyDocument:
      Statement:
        - Effect: Allow
          Principal:
            Service: ec2.amazonaws.com
          Action: sts:AssumeRole
    Policies:
      - PolicyName: ReadS3
        PolicyDocument:
          Statement:
            - Effect: Allow
              Action:
                - s3:GetObject
                - s3:ListBucket
              Resource: '*'
B
MyRole:
  Type: AWS::IAM::Role
  Properties:
    AssumeRolePolicyDocument:
      Statement:
        - Effect: Allow
          Principal:
            Service: ec2.amazonaws.com
          Action: sts:AssumeRole
    Policies:
      - PolicyName: ReadS3
        PolicyDocument:
          Statement:
            - Effect: Allow
              Action: s3:*
              Resource: '*'
C
MyRole:
  Type: AWS::IAM::Role
  Properties:
    AssumeRolePolicyDocument:
      Statement:
        - Effect: Deny
          Principal:
            Service: ec2.amazonaws.com
          Action: sts:AssumeRole
    Policies:
      - PolicyName: ReadS3
        PolicyDocument:
          Statement:
            - Effect: Allow
              Action:
                - s3:GetObject
                - s3:ListBucket
              Resource: '*'
D
MyRole:
  Type: AWS::IAM::Role
  Properties:
    AssumeRolePolicyDocument:
      Statement:
        - Effect: Allow
          Principal:
            Service: lambda.amazonaws.com
          Action: sts:AssumeRole
    Policies:
      - PolicyName: ReadS3
        PolicyDocument:
          Statement:
            - Effect: Allow
              Action:
                - s3:GetObject
                - s3:ListBucket
              Resource: '*'
Attempts:
2 left
💡 Hint

Check the service principal and the actions allowed in the policy.

❓ service_behavior
expert
2:00remaining
Predicting CloudFormation Stack Behavior with Resource Updates
You update a CloudFormation template's Resources section by changing the InstanceType property of an EC2 instance resource from t2.micro to t3.micro. What will CloudFormation do when you update the stack?
ACloudFormation will fail the update with a validation error due to incompatible instance types.
BCloudFormation will replace the EC2 instance by creating a new one with the new instance type and deleting the old one.
CCloudFormation will ignore the change because instance type is not an updatable property.
DCloudFormation will perform an in-place update of the EC2 instance, changing the instance type without replacement.
Attempts:
2 left
💡 Hint

Consider whether changing instance type requires replacement or can be updated in place.

Practice

(1/5)
1. What is the main purpose of the Resources section in an AWS CloudFormation template?
easy
A. To define the cloud parts AWS should create
B. To specify user permissions
C. To write code logic for the application
D. To store data in the cloud

Solution

  1. Step 1: Understand the role of the Resources section

    The Resources section lists all the cloud components AWS will build, like servers or databases.
  2. Step 2: Compare with other template sections

    Other sections handle permissions or outputs, but Resources is for creating cloud parts.
  3. Final Answer:

    To define the cloud parts AWS should create -> Option A
  4. Quick Check:

    Resources section = define cloud parts [OK]
Hint: Resources section always defines what AWS builds [OK]
Common Mistakes:
  • Confusing Resources with Permissions or Outputs
  • Thinking Resources stores data
  • Assuming Resources runs application code
2. Which of the following is the correct way to start defining a resource named MyBucket of type AWS::S3::Bucket in the Resources section?
easy
A. "MyBucket": "AWS::S3::Bucket"
B. "Type": "AWS::S3::Bucket", "MyBucket": {}
C. "MyBucket": { "Type": "AWS::S3::Bucket" }
D. "AWS::S3::Bucket": { "MyBucket": {} }

Solution

  1. Step 1: Check resource name and type syntax

    Each resource needs a unique name as key, then a block with a Type property.
  2. Step 2: Match correct JSON structure

    "MyBucket": { "Type": "AWS::S3::Bucket" } correctly uses the resource name as key and sets Type inside an object.
  3. Final Answer:

    "MyBucket": { "Type": "AWS::S3::Bucket" } -> Option C
  4. Quick Check:

    Resource name as key + Type property = "MyBucket": { "Type": "AWS::S3::Bucket" } [OK]
Hint: Resource name is key, Type is inside its object [OK]
Common Mistakes:
  • Putting Type outside resource object
  • Using resource type as key instead of name
  • Missing curly braces for resource details
3. Given this Resources snippet in a CloudFormation template:
{
  "MyInstance": {
    "Type": "AWS::EC2::Instance",
    "Properties": {
      "InstanceType": "t2.micro",
      "ImageId": "ami-12345678"
    }
  }
}

What will AWS create when this template is deployed?
medium
A. An EC2 instance of type t2.micro with the specified AMI
B. An S3 bucket named MyInstance
C. A Lambda function with t2.micro memory
D. A database instance with ImageId ami-12345678

Solution

  1. Step 1: Identify resource type and properties

    The resource type is AWS::EC2::Instance, which creates a virtual server.
  2. Step 2: Understand properties meaning

    InstanceType t2.micro means a small server; ImageId specifies the server image.
  3. Final Answer:

    An EC2 instance of type t2.micro with the specified AMI -> Option A
  4. Quick Check:

    EC2 instance with given type and image = An EC2 instance of type t2.micro with the specified AMI [OK]
Hint: Type AWS::EC2::Instance means a virtual server [OK]
Common Mistakes:
  • Confusing EC2 with S3 or Lambda
  • Ignoring Properties section
  • Assuming ImageId is a database ID
4. You wrote this Resources section snippet:
{
  "MyBucket": {
    "Type": "AWS::S3::Bucket",
    "Properties": {
      "BucketName": 12345
    }
  }
}

What is the error in this configuration?
medium
A. Type AWS::S3::Bucket is invalid
B. BucketName must be a string, not a number
C. Properties section is missing
D. Resource name cannot be MyBucket

Solution

  1. Step 1: Check BucketName property type

    BucketName must be text (string), but 12345 is a number here.
  2. Step 2: Validate other parts

    Type and Properties exist and resource name is valid, so no error there.
  3. Final Answer:

    BucketName must be a string, not a number -> Option B
  4. Quick Check:

    BucketName requires string value = BucketName must be a string, not a number [OK]
Hint: BucketName must be quoted text, not a number [OK]
Common Mistakes:
  • Using numbers instead of strings for names
  • Misnaming resource types
  • Omitting Properties section
5. You want to create two resources in your template: an S3 bucket named MyDataBucket and an EC2 instance named MyWebServer. Which Resources section snippet correctly defines both with minimal required properties?
hard
A. { "MyDataBucket": { "Type": "AWS::S3::Bucket", "Properties": { "InstanceType": "t3.micro" } }, "MyWebServer": { "Type": "AWS::EC2::Instance" } }
B. { "AWS::S3::Bucket": { "MyDataBucket": {} }, "AWS::EC2::Instance": { "MyWebServer": { "InstanceType": "t3.micro", "ImageId": "ami-0abcdef1234567890" } } }
C. { "MyDataBucket": { "Type": "AWS::EC2::Instance" }, "MyWebServer": { "Type": "AWS::S3::Bucket", "Properties": { "InstanceType": "t3.micro" } } }
D. { "MyDataBucket": { "Type": "AWS::S3::Bucket" }, "MyWebServer": { "Type": "AWS::EC2::Instance", "Properties": { "InstanceType": "t3.micro", "ImageId": "ami-0abcdef1234567890" } } }

Solution

  1. Step 1: Verify resource names and types

    MyDataBucket must be AWS::S3::Bucket, MyWebServer must be AWS::EC2::Instance.
  2. Step 2: Check required properties for EC2

    EC2 instance requires InstanceType and ImageId properties; S3 bucket can be empty.
  3. Step 3: Identify correct JSON structure

    { "MyDataBucket": { "Type": "AWS::S3::Bucket" }, "MyWebServer": { "Type": "AWS::EC2::Instance", "Properties": { "InstanceType": "t3.micro", "ImageId": "ami-0abcdef1234567890" } } } correctly defines both resources with proper types and properties.
  4. Final Answer:

    { "MyDataBucket": { "Type": "AWS::S3::Bucket" }, "MyWebServer": { "Type": "AWS::EC2::Instance", "Properties": { "InstanceType": "t3.micro", "ImageId": "ami-0abcdef1234567890" } } } -> Option D
  5. Quick Check:

    Correct types and properties for both resources = { "MyDataBucket": { "Type": "AWS::S3::Bucket" }, "MyWebServer": { "Type": "AWS::EC2::Instance", "Properties": { "InstanceType": "t3.micro", "ImageId": "ami-0abcdef1234567890" } } } [OK]
Hint: S3 needs Type only; EC2 needs Type plus InstanceType and ImageId [OK]
Common Mistakes:
  • Swapping resource types
  • Putting resource names inside types
  • Missing required EC2 properties
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard