Skip to content

Live-verify a way to end an untagged Spot replacement without a person (follow-up to #984) #995

Closed

Description

@scttfrdmn

Follow-up to #984. The fix for #984 kept the SPOT REPLACEMENT NOT TERMINATED alarm and made it actionable, because no option could be shown to be safe without a live account. These two remain open, and each needs a live check this repo has not done.

1. Have spored in the replacement end itself. No new IAM is needed for detection:

  • DescribeInstances on itself gives SpotInstanceRequestId.
  • DescribeTags filtered by resource-id=sir-… reads the request's tags. The spored role already grants both, unconditioned and read-only.
  • A safe detection rule: the request has spawn:managed=true, and the request's spawn:original-instance-id is present and is not this instance's id. For an original instance that tag is either absent (not yet written) or equal to its own id, so an original can never match.
  • spored can cancel the request, which is spawn-tagged and covered by its existing grant, then shut down from the OS.

Unknowns to check with a real leaked persistent request:

  • Does the replacement run the request's UserData, and so start spored at all?
  • Does it get spawn's instance profile from the request's LaunchSpecification?
  • Does an OS shutdown of a replacement terminate it or stop it? The request's launch spec has no InstanceInitiatedShutdownBehavior. If it stops, the reaper still reports it, as a stopped instance with a cancelled request, and it bills EBS only.

2. A second reaper terminate condition. ec2:InstanceProfile (ArnLike spawn's profiles) plus ec2:InstanceMarketType=spot. Both are listed for the instance resource of TerminateInstances in the service reference. Before adopting it:

Not available: an IAM condition tying an instance to its Spot request. The instance resource has no such key, aws:ResourceTag on an instance action is the instance's tags, and spot-instances-request has only tag and region keys. Checked against servicereference.us-east-1.amazonaws.com/v1/ec2/ec2.json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions