
Answer-first summary for fast verification
Answer: The PrivateDnsName cannot be set from a CloudFormation template.
The PrivateDnsName property cannot be set in an AWS CloudFormation template. It is automatically assigned by AWS when the instance is launched. The other options are incorrect: Outputs and Parameters are optional sections, and the VPC is inferred from the SubnetId if provided.
Author: Ritesh Yadav
Ultimate access to all questions.
Question #1
A CloudOps engineer is examining the following AWS CloudFormation template:
AWSTemplateFormatVersion: '2010-09-09'
Description: 'Creates an EC2 Instance'
Resources:
EC2Instance:
Type: AWS::EC2::Instance
Properties:
ImageId: ami-79fdTeee
InstanceType: m5n.large
SubnetId: subnet-1abc3d3fg
PrivateDnsName: ip-10-24-34-0.ec2.internal
Tags:
- Key: Name
Value: !Sub "${AWS::StackName} Instance"
AWSTemplateFormatVersion: '2010-09-09'
Description: 'Creates an EC2 Instance'
Resources:
EC2Instance:
Type: AWS::EC2::Instance
Properties:
ImageId: ami-79fdTeee
InstanceType: m5n.large
SubnetId: subnet-1abc3d3fg
PrivateDnsName: ip-10-24-34-0.ec2.internal
Tags:
- Key: Name
Value: !Sub "${AWS::StackName} Instance"
Why will the stack creation fail?
A
The Outputs section of the CloudFormation template was omitted.
B
The Parameters section of the CloudFormation template was omitted.
C
The PrivateDnsName cannot be set from a CloudFormation template.
D
The VPC was not specified in the CloudFormation template.
No comments yet.