问题描述
我正在创建 CloudFormation 模板以使用 AWS::EKS::Nodegroup CloudFormation 资源部署 EKS 节点组.
I'm creating a CloudFormation template to deploy an EKS node group using the AWS::EKS::Nodegroup CloudFormation resource.
您似乎可以专门为节点组资源创建标签,但不能更改作为节点组一部分部署的 EC2 实例的名称.从 AWS 文档来看,标签似乎没有传播到节点组部署的其他资源(例如 EC2 实例).
It looks like you can create tags for the node group resource specifically, but cannot change the name of the EC2 instances that are deployed as part of the node group. From the AWS documentation, it looks like tags are not propagated to other resources the node group deploys (such as EC2 instances).
有谁知道在我们部署新的 EKS 节点组时如何更新 EC2 实例的名称?这是否需要执行 lambda 函数来修改 EC2 实例?
Does anyone know of a way on how we can update the name of the EC2 instances when we deploy a new EKS node group? Would this require a lambda function to be executed to modify the EC2 instances?
推荐答案
目前没有办法传递标签Name"以便实例被适当地命名.这适用于地形和云的形成.
Currently there is no way to pass tag "Name" so that instance will be named appropriately. This is applicable to both terraform and cloud formation.
我在这里看到的两个选项是;
Two options I see here are;
为您标记实例的 Lambda 函数.
Lambda function that tags instances for you.
您可以将其烘焙到 AMI 中.因此,您将拥有一个 systemd 脚本,该脚本将在启动时执行并根据需要标记您的实例.
You can bake it into an AMI. So, you would have a systemd script which will execute on boot and tag your instances as desired.
这篇关于在 CloudFormation 中部署 AWS::EKS::Nodegroup 时向 EC2 实例添加名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!