SAP-C02 Design for New Solutions Practice Question
Exhibit
Refer to the exhibit.
CloudFormation template snippet:
```yaml
Resources:
MyEC2Instance:
Type: AWS::EC2::Instance
Properties:
ImageId: ami-12345678
InstanceType: t2.micro
SecurityGroups:
- !Ref MySecurityGroup
MySecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Allow SSH
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 22
ToPort: 22
CidrIp: 0.0.0.0/0
```A solutions architect attempts to create this stack but receives an error: "Value of property SecurityGroups must be a list of strings". What is the likely cause?
⚠ Common exam trap
Candidates often confuse the SecurityGroups property with SecurityGroupIds, or assume that a single reference can be passed as a scalar, but CloudFormation strictly enforces the list type for SecurityGroups even when only one security group is used.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The SecurityGroups property should be a list, but the YAML specifies a single reference incorrectly.
The error 'Value of property SecurityGroups must be a list of strings' occurs because the YAML template specifies the SecurityGroups property as a single string (e.g., !Ref MySecurityGroup) instead of a list of strings (e.g., [!Ref MySecurityGroup]). In AWS CloudFormation, the SecurityGroups property for an EC2 instance expects a list of security group IDs or names, even if only one security group is provided. The YAML syntax must wrap the reference in square brackets to form a list, or the template will fail validation.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
The SecurityGroups property should be a list, but the YAML specifies a single reference incorrectly.
Why this is correct
The error occurs when the SecurityGroups property is provided as a single string instead of a list. In CloudFormation, even one security group must be specified as a list, e.g., [!Ref MySecurityGroup].
- ✗
The security group ingress rule allows SSH from anywhere.
Why it's wrong here
The ingress rule allowing SSH from anywhere is a separate security group configuration, not the cause of the 'list of strings' error.
- ✗
There is a circular dependency between the EC2 instance and the security group.
Why it's wrong here
A circular dependency would cause a different error, such as a stack update failure, not the SecurityGroups list type error.
- ✗
The AMI ID is invalid.
Why it's wrong here
An invalid AMI ID would result in an error about the AMI, not about the SecurityGroups property type.
Visual reference
Go deeper
Related to this question
About these practice questions
Courseiva writes every SAP-C02 question from scratch — 1,660 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This SAP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SAP-C02 exam.