属性 IamInstanceProfile 的值必须是字符串类型
Value of property IamInstanceProfile must be of type String
我想从另一个堆栈引用我的实例配置文件值。
如果实例配置文件资源在模板中,我可以 !Ref 资源名称
---
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"
我想从另一个堆栈引用我的实例配置文件值。
如果实例配置文件资源在模板中,我可以 !Ref 资源名称
---
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"