I'm trying to use CloudFormation to deploy two Windows Server 2019 EC2 instances and also attach a new volume to each instance (two instances, two volumes total). I get the following error when I deploy:
Value of property Tags must be of type List
From my research, it sounds like the way I'm referencing the volumes I'm trying to create could be the issue but not sure.
Here's some of my template for reference:
Resources:
rpt04:
Type: 'AWS::EC2::Instance'
Properties:
AvailabilityZone: us-west-1
InstanceType: t2.large
ImageId: ami-0cc5ea3dde5301489
Tags:
- Key: "Name"
Value: "RPT-04 (W2K16)"
KeyName: Key_2020
SecurityGroupIds:
- sg-f2bcJmn9
SubnetId: subnet-19234d70
BlockDeviceMappings:
- DeviceName: /dev/sda1
Ebs:
VolumeSize: 100
DeleteOnTermination: true
Volumes:
-
Device: xvdb
VolumeId: !Ref rpt04appvolume
Metadata:
'AWS::CloudFormation::Designer':
id: 357656a6-846b-4674-b06a-22901916ff91
rpt04appvolume:
Type: 'AWS::EC2::Volume'
Properties:
AvailabilityZone: us-west-1
Size: 100
VolumeType: gp2
Tags:
Key: Name
Value: RPT-04-APP
Metadata:
'AWS::CloudFormation::Designer':
id: 3340c328-2324-42e5-bd11-b3c1d1f41a09
I'd appreciate any help/assistance on this. I'm new to CloudFormation and stuck on this one.
Here's an example which shows multiple tags. The instance type is Linux, but Windows is the same in CF.
What I've copied a mix of a template that I use regularly with a few of your IDs copied in. My actual template heavily references resources I've created in other templates with !ImportValue and things defined in this template with !Ref
In
rpt04appvolume
you're missing a-
inTags
:Change it from this:
to this:
By the way -
AvailabilityZone: us-west-1
should instead be us-west-1a or b or something. That us-west-1 alone is a region name not an availability zone name.Hope that helps :)