当 cloudformation 构建堆栈时,我收到以下错误:
AWS::AutoScaling::LaunchConfiguration N1ClusterServerLaunchConfig 您无权执行此操作
我拥有管理员完全访问用户权限。但是,这仍然失败了。授权是由于模板内定义的 IAM 造成的吗?
"N1ClusterServerAutoScale": {
"Type": "AWS::AutoScaling::AutoScalingGroup",
"Properties": {
"AvailabilityZones": {
"Fn::GetAZs": ""
},
"LaunchConfigurationName": {
"Ref": "N1ClusterServerLaunchConfig"
},
"MinSize": "2",
"MaxSize": "64",
"DesiredCapacity": {
"Ref": "ClusterSize"
},
"Tags": [
{
"Key": "Name",
"Value": {
"Ref": "AWS::StackName"
},
"PropagateAtLaunch": true
}
]
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "a715af00-ebba-4fab-a817-d5ee1986dfe7"
}
}
},
"N1ClusterServerLaunchConfig": {
"Type": "AWS::AutoScaling::LaunchConfiguration",
"Properties": {
"ImageId": {
"Fn::FindInMap": [
"RegionMap",
{
"Ref": "AWS::Region"
},
"hvm"
]
},
"InstanceType": {
"Ref": "InstanceType"
},
"KeyName": {
"Ref": "KeyPair"
},
"SecurityGroups": [
{
"Ref": "N1ClusterSecurityGroup"
},
{
"Ref": "N1NodeSecurityGroup"
}
],
"IamInstanceProfile": {
"Ref": "IamInstanceProfile"
},
IAM
"AllowComputeFrom": {
"Description": "The net block (CIDR) that N1-COMPUTE is available to.",
"Default": "0.0.0.0/0",
"Type": "String"
},
"IamInstanceProfile": {
"Description": "The name of an IAM Profile which can access required S3 buckets and instances.",
"Default": "arn:aws:iam::247256189695:instance-profile/n1-compute-instance",
"Type": "String"
},
"IamInstanceProfileShort": {
"Description": "The last part of the name of an IAM Profile which can create instances.",
"Default": "n1-compute-instance",
"Type": "String"
},
最佳答案
使用 boto3 和 aws Lambda 创建 Autoscaling 和 Launchtemplate 时,我收到了相同的错误。向 Lambda 角色添加以下权限解决了该问题 -
iam:CreateInstanceProfile, iam:Passrole, iam:CreateServiceLinkedRole, iam:GetInstanceProfile, iam:ListInstanceProfile, iam:UpdateRole, iam:ListInstanceProfiles, iam:AddRoleToInstanceProfile, iam:TagInstanceProfile,
enter link description here
对于使用cloudformation的人可以添加相同的内容。
关于amazon-web-services - AWS::AutoScaling::LaunchConfiguration 您无权执行此操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40623119/