AWS 堆栈更新和 ENI

AWS 堆栈更新和 ENI

当我尝试使用新映像更新堆栈中的一个实例时,出现错误信息:“接口:yyy 正在使用中”。这听起来像是因为我在堆栈模板中使用了 ENI,因此它们所附加到的实例无法更新,而且堆栈似乎不够智能,无法根据更新的需要断开和重新附加 ENI。

我该如何解决这个问题?

编辑:这是堆栈模板中实例和 ENI 的配置。

"DomainControllerIP": {
    "Type": "AWS::EC2::EIP",
    "Properties": {
        "Domain": "vpc"
    }
},

"DomainControllerEIPAssociation" : {
  "Type" : "AWS::EC2::EIPAssociation",
  "Properties" : {
    "AllocationId" : { "Fn::GetAtt" : [ "DomainControllerIP", "AllocationId" ]},
    "NetworkInterfaceId" : { "Ref" : "DomainControllerServerENI" }
  }
},

"DomainControllerServerENI" : {
    "Type" : "AWS::EC2::NetworkInterface",
    "DependsOn" : "DomainControllerInstance",
    "Properties" : {
        "Description": "Domain Controller Server ENI",
        "SourceDestCheck": "true",
        "GroupSet": [{ "Ref": "DomainControllerSecurityGroup" }, { "Ref": "DomainMemberSecurityGroup" }],
        "SubnetId": { "Ref": "PublicSubnet4" },
        "PrivateIpAddress": "172.30.5.45"
    }
},

"DomainControllerENIAttachment" : {
    "Type" : "AWS::EC2::NetworkInterfaceAttachment",
        "Properties" : {
            "InstanceId" : {"Ref" : "DomainControllerInstance"},
            "NetworkInterfaceId" : {"Ref" : "DomainControllerServerENI"},
            "DeviceIndex" : "1" 
        }
},

"DomainControllerInstance": {
    "Type": "AWS::EC2::Instance",
    "Properties": {
        "ImageId": { "Ref" : "DomainControllerAMIId" },
        "InstanceInitiatedShutdownBehavior": "stop",
        "InstanceType": { "Ref" : "DomainControllerInstanceType" },
        "KeyName": { "Ref": "DomainControllerKeyName" },
        "Tags": [
            {
                "Key": "Name",
                "Value": { "Fn::Join" : [ " ", [{ "Ref" : "AWS::StackName" }, "Domain Controller"]]}
            }
        ],
        "SecurityGroupIds": [
            {
                "Ref": "DomainControllerSecurityGroup"
            },
            {
                "Ref": "DomainMemberSecurityGroup"
            }
        ],
        "SubnetId": { "Ref": "PublicSubnet4" }
    }
},

相关内容