我正试图通过python脚本进行蓝绿色部署,但当我运行以下代码时
modifyOnBeta = elb_client.modify_rule(
RuleArn=betarulearn,
Actions=[
{
'Type': 'forward',
'TargetGroupArn': live_target_group
}
]
)
我得到以下错误
botocore.errorfactory.OperationNotPermittedException: An error occurred (OperationNotPermitted) when calling the ModifyRule operation: Default rule 'arn:aws:elasticloadbalancing:us-east-1:XXXXXXXXXXXX:listener-rule/app/some-alb/XXXX/XXXX/XXXX' cannot be modified
我遇到了同样的问题。在修改规则文档页面的顶部,我发现了以下语句。
若要修改默认规则的操作,请使用ModifyListener。https://docs.aws.amazon.com/cli/latest/reference/elbv2/modify-listener.html
而不是
modifyOnBeta = elb_client.modify_rule(
RuleArn=betarulearn,
Actions=[
{
'Type': 'forward',
'TargetGroupArn': live_target_group
}
]
)
使用
modifyOnBeta = elb_client.modify_listener(
ListenerArn='string',
DefaultActions=[
{
'Type': 'forward',
'TargetGroupArn': live_target_group
}
]
)