首页 > 解决方案 > 删除 CloudFormation 堆栈后未取消的 Spot 请求

问题描述

我有一个创建点实例的云形成模板。它具有以下基本结构:

AWSTemplateFormatVersion: 2010-09-09
Resources:
  launchTemplate:
    Type: AWS::EC2::LaunchTemplate
    Properties:  
      LaunchTemplateData:
        IamInstanceProfile:
          Arn: <my-role>
      InstanceType: t2.micro
      ImageId: <my-ami-image>
      NetworkInterfaces:
      - AssociatePublicIpAddress: false
        DeviceIndex: 0
        SubnetId: <my-subnet-id>
        Groups:
        - <my-security-group>
     KeyName: <my-key>

  spotInstance:
    DependsOn:
    - launchTemplate
    Properties:
      LaunchTemplate:
        LaunchTemplateId:
          Ref: launchTemplate
        Version: 1
    Type: AWS::EC2::Instance

当我创建堆栈时,创建现场请求没有问题,并且现场实例被创建。但是,当我删除堆栈时,它会删除现场实例而不取消现场请求。因此,很快就会创建一个新的 Spot 实例。

我想知道现场请求没有被取消的原因可能是什么?

标签: amazon-web-servicesamazon-ec2amazon-cloudformation

解决方案


推荐阅读