简体   繁体   English

用于使用现有目标组配置新 EC2 实例的 AWS CF 模板

[英]AWS CF Template for provisioning new EC2 instance with Existing Targetgroup

I'm trying to provision a new EC2 instance and attaching it to the existing targetGroup which I created earlier.我正在尝试提供一个新的 EC2 实例并将其附加到我之前创建的现有targetGroup I do have the targetGroupArn , and the new instance details.我确实有targetGroupArn和新实例的详细信息。 In all the documents, I could see the sample templates of creating a new instance and new targetgroup and referring the instance id to the creating targetgroup .在所有文档中,我可以看到创建新实例和新目标组并将实例 ID 引用到创建目标组的示例模板

Is there any option to create only new instance and attaching it to the existing target group?

So that I can mention the targetGroupArn to which the new instances will be attaching.这样我就可以提及新实例将附加到的targetGroupArn Below I've mentioned the sample templates, what I'm looking for.下面我提到了示例模板,我正在寻找什么。

{
  "Type": "AWS::ElasticLoadBalancingV2::TargetGroup",
  "Properties": {
    "TargetGroupArn": "arn:aws:elasticloadbalancing:ap-south-1:4444444444:targetgroup/MyTG/56abcccccccc56",
    "Targets": [
      {
        "Id": {
          "Ref": "ec2Instance1"
        }
      }
    ]
  }
}

Is there any option to create only new instance and attaching it to the existing target group?是否可以选择仅创建新实例并将其附加到现有目标组?

Yes, you can do that through a custom resources in the form of a lambda function. The function would use AWS SDK, such as boto3 , to attach the instances to the existing target group.是的,您可以通过 lambda function 形式的自定义资源来实现。function 将使用 AWS SDK(例如boto3 )将实例附加到现有目标组。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM