问题描述
---
AWstemplateFormatVersion: '2010-09-09'
Parameters:
SSMInstanceProfilestack:
Description: instance profile stack
Type: String
Default: instance-profile
Resources:
Ec2:
Type: AWS::EC2::Instance
Properties:
InstanceType: t2.micro
ImageId: ami-077a5b1762a2dde35
IamInstanceProfile:
- Fn::ImportValue:
Fn::Sub: "${SSMInstanceProfilestack}-Suffix"
Tags:
- Key: Name
Value: Ec2SandPit
Outputs:
Ec2Output:
Description: A bare bone Ec2 instance
Value: !Ref Ec2
Export:
Name: !Sub "${AWS::StackName}-Ec2"
我收到此错误,资源已部署。
Value of property IamInstanceProfile must be of type String
有没有办法解决这个问题?
解决方法
IamInstanceProfile
应该是仅字符串,而不是字符串列表。所以应该是(删除-
):
IamInstanceProfile:
Fn::ImportValue:
Fn::Sub: "${SSMInstanceProfileStack}-Suffix"