0
0
AWScloud~20 mins

Template structure (JSON/YAML) in AWS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Cloud Template Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Identify the main sections of an AWS CloudFormation template

Which of the following lists correctly shows the main sections of a valid AWS CloudFormation template in JSON or YAML?

AParameters, Resources, Outputs, Mappings, Conditions, Transform, Metadata
BResources, Variables, Functions, Outputs, Conditions
CParameters, Resources, Scripts, Outputs, Policies
DResources, Outputs, Variables, Templates, Conditions
Attempts:
2 left
💡 Hint

Think about the sections that define inputs, resources, and outputs in a CloudFormation template.

Configuration
intermediate
1:30remaining
Determine the number of resources defined in this CloudFormation snippet

Given the following JSON snippet of a CloudFormation template, how many AWS resources are defined?

{
  "Resources": {
    "MyBucket": {
      "Type": "AWS::S3::Bucket"
    },
    "MyQueue": {
      "Type": "AWS::SQS::Queue"
    },
    "MyTopic": {
      "Type": "AWS::SNS::Topic"
    }
  }
}
A3
B2
C1
D4
Attempts:
2 left
💡 Hint

Count the top-level keys inside the Resources section.

Architecture
advanced
2:30remaining
Choose the correct YAML template structure for conditional resource creation

Which YAML snippet correctly uses a condition to create an AWS resource only if a parameter value is 'true'?

A
Parameters:
  CreateBucket:
    Type: String
    AllowedValues: [true, false]
Conditions:
  ShouldCreateBucket: !Equals [!Ref CreateBucket, true]
Resources:
  MyBucket:
    Type: AWS::S3::Bucket
    Condition: ShouldCreateBucket
B
Parameters:
  CreateBucket:
    Type: Boolean
Conditions:
  ShouldCreateBucket: !Equals [!Ref CreateBucket, 'true']
Resources:
  MyBucket:
    Type: AWS::S3::Bucket
    Condition: ShouldCreateBucket
C
Parameters:
  CreateBucket:
    Type: String
    AllowedValues: [yes, no]
Conditions:
  ShouldCreateBucket: !Equals [!Ref CreateBucket, 'true']
Resources:
  MyBucket:
    Type: AWS::S3::Bucket
    Condition: ShouldCreateBucket
D
Parameters:
  CreateBucket:
    Type: String
    AllowedValues: [true, false]
Conditions:
  ShouldCreateBucket: !Equals [!Ref CreateBucket, 'true']
Resources:
  MyBucket:
    Type: AWS::S3::Bucket
    Condition: ShouldCreateBucket
Attempts:
2 left
💡 Hint

Check the parameter type, allowed values, and how the condition compares the parameter value.

security
advanced
2:00remaining
Identify the security risk in this CloudFormation template snippet

Review the following JSON snippet. What is the main security risk?

{
  "Resources": {
    "MyBucket": {
      "Type": "AWS::S3::Bucket",
      "Properties": {
        "BucketName": "my-public-bucket",
        "AccessControl": "PublicRead"
      }
    }
  }
}
AThe bucket name is not unique, causing deployment failure
BThe AccessControl property is missing, so the bucket is private by default
CThe bucket is publicly readable, exposing data to anyone on the internet
DThe bucket does not have versioning enabled, risking data loss
Attempts:
2 left
💡 Hint

Consider what 'PublicRead' means for an S3 bucket's accessibility.

service_behavior
expert
3:00remaining
Predict the output of a CloudFormation stack update with a changed resource property

Given a CloudFormation template with an AWS::EC2::Instance resource, if you update the template to change the instance type from 't2.micro' to 't3.micro' and then update the stack, what will happen?

ACloudFormation updates the instance type in place without replacement or downtime
BCloudFormation replaces the instance with a new one of type 't3.micro', causing downtime
CCloudFormation fails the update because instance type cannot be changed
DCloudFormation creates a second instance of type 't3.micro' alongside the original
Attempts:
2 left
💡 Hint

Consider how CloudFormation handles changes to properties that require resource replacement.