Bird
0
0

Which Resources section snippet correctly defines both with minimal required properties?

hard📝 Best Practice Q15 of 15
AWS - CloudFormation
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?
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" } } }
Step-by-Step Solution
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]
Quick Trick: 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

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes