我正在尝试使用 cloudformation 模板中的现有角色(存在于 AWS 帐户中)来设置 lambda 函数,我计划在多个 AWS 帐户中使用它。
在 CF 模板中,我使用参数来设置角色的名称,然后在 Lambda 函数的角色属性中使用 Ref。这就是我的模板的样子,
"Parameters" : {
"ExistingRoleName" : {
"Type" : "String",
"Default" : "MyCustomRole"
}
"Resources" : {
"CustomLambdaFunction" : {
"Type" : "AWS::Lambda::Function",
"Properties" : {
"MemorySize" : "128",
"Role" : { "Ref" : "ExistingRoleName" },
}
},
...
Run Code Online (Sandbox Code Playgroud)
但是,CF 模板失败并出现以下错误:
Properties validation failed for resource CustomLambdaFunction with message: #/Role: failed validation constraint for keyword [pattern]
Run Code Online (Sandbox Code Playgroud)
这是因为 Cloudformation 中的 Lambda 资源需要角色 arn 而不是 RoleName,正如我在此文档aws-resource-lambda-function中看到的那样
基于此我像这样更新了CF, …
有时 k8s 节点被标记为k8s.infra/postgres=. 这是节点的有效标签吗?
我们如何使用这种标签,同时在部署清单中添加节点关联性?
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: k8s.infra/postgres
operator: Exists
values:
-
-
Run Code Online (Sandbox Code Playgroud) 给定 VPC id;我使用 AWS CLI 和 jq 来派生给定 VPC ID 的 NAT 网关地址。这是我到目前为止所拥有的:
aws ec2 describe-nat-gateways --region='${aws_region}' | jq -r --arg efs_name ${vpcid} '.[] | .[] | select(.VpcId==$vpcid) | {nats: .NatGatewayAddresses}'
Run Code Online (Sandbox Code Playgroud)
输出是:
{
"nats": [
{
"PublicIp": "52.34.207.107",
"NetworkInterfaceId": "eni-0bc0d320",
"AllocationId": "eipalloc-fa7739c0",
"PrivateIp": "172.20.130.224"
}
]
}
Run Code Online (Sandbox Code Playgroud)
有没有办法PublicIp直接使用 AWS CLI 筛选器获取 nat-gateways 资源?