【发布时间】:2020-12-17 09:32:48
【问题描述】:
我有下面的模板,它描述了一个新的 OpsWorks 堆栈。它依赖于帐户中已经存在的两个角色,但我需要使用 !Ref 作为帐户 ID,因为此模板可以在任何地方生成堆栈。
Stack4:
Type: AWS::OpsWorks::Stack
Condition: CreateStack4
Properties:
Name: !Ref StackName4
DefaultOs: 'Amazon Linux 2'
VpcId: !Ref VpcId
DefaultSubnetId: !Ref SubnetId
UseOpsworksSecurityGroups: True
CustomCookbooksSource:
Type: 's3'
Url: https://oidigital-chef-recipes.s3.amazonaws.com/prd/aws-chef-recipes-master.zip
ConfigurationManager:
Name: Chef
Version: "12"
DefaultInstanceProfileArn: !Join
- ''
- - 'arn:aws:iam::'
- !Ref 'AWS::AccountId'
- ':role/DefaultOiServerRole'
ServiceRoleArn: !Join
- ''
- - 'arn:aws:iam::'
- !Ref 'AWS::AccountId'
- ':role/aws-opsworks-service-role'
由于某种原因,DefaultInstanceProfileArn 中的 !Join 声明未按预期工作。尝试创建堆栈时,会抛出以下错误。
Default Instance Profile Arn: must be an instance profile ARN belonging to AWS account
【问题讨论】:
标签: amazon-web-services amazon-cloudformation