I am trying to launch a spot fleet request via a clouldformation yaml. During this process, I keep getting an error "#/SpotFleetRequestConfigData/LaunchSpecifications/0/IamInstanceProfile: expected type: JSONObject, found: String"
For some reason, I am unable to pass the role to the spot instance getting created. the script works fine without this particular line. the failiing line is the first one in LaunchSpecifications. i tried to pipe in the raw json too, but that gives the same error. My guess is this is just a bad error message. How do i resolve this? Is there a way to check if this is a permissions issue? Also, this config works with launching a plain old ec2 instance. Just fails in the case of a SpotFleet request.
AWSTemplateFormatVersion: 2010-09-09
Description: >-
AWS CloudFormation template for launching a spot ec2-instance
Resources:
SpotInstance:
Type: "AWS::EC2::SpotFleet"
Properties:
SpotFleetRequestConfigData:
IamFleetRole: arn:aws:iam::773057xxxxxx:role/aws-ec2-spot-fleet-tagging-role
TargetCapacity: 1
LaunchSpecifications:
- IamInstanceProfile: arn:aws:iam::773057xxxxxx:instance-profile/EC2_Role_R53
KeyName: xxxxxxxxxxxxxx
NetworkInterfaces:
- AssociatePublicIpAddress: true
DeleteOnTermination: true
DeviceIndex: '0'
SubnetId: subnet-e18921ca
Groups:
- sg-cfa4c3ab
- sg-01d9bd3d67ed8a312
ImageId: ami-0574da719dca65348 #generic ubuntu ami 22.04
InstanceType: t2.medium
Thanks so much. This is what the script wanted!