fix(ec2,ssm): echo IamInstanceProfile; gate SSM PingStatus on a profile (#331)#332
Merged
Merged
Conversation
…le (#331) Two EC2/SSM fidelity gaps surfaced by spawn's warm-AMI SSM-readiness logic. Gap 2 (Fixed): DescribeInstances dropped IamInstanceProfile. RunInstances already stored it; the describe response now includes iamInstanceProfile {arn, id} so a caller can read back the profile it set. Gap 1 (Changed): DescribeInstanceInformation reported every running instance as PingStatus=Online. Real SSM registration needs an IAM instance profile granting ssm:UpdateInstanceInformation; an instance with no profile never registers. Now only profile-bearing running instances are listed, so callers can distinguish a 'dead' instance (no profile) from an SSM-managed one. Eligibility = profile presence (substrate does not model profile->policy attachment). Tests: TestEC2_DescribeInstances_EchoesIamInstanceProfile and TestSSM_DescribeInstanceInformation_RequiresProfile (end-to-end via a combined EC2+SSM server). make test (race) + lint clean. Closes #331
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two EC2/SSM fidelity gaps surfaced by spawn's warm-AMI SSM-readiness logic (spore-host/spawn#98, #181).
Gap #2 —
DescribeInstancesdroppedIamInstanceProfile(Fixed)RunInstancesaccepted and stored the profile, but the describe response had no field for it. Now the response includesiamInstanceProfilewitharnandid, so a caller can read back the profile it attached. (Bare names are surfaced as a synthesizedinstance-profile/<name>ARN.)Gap #1 — SSM
DescribeInstanceInformationalways reportedOnline(Changed)Every running instance appeared with
PingStatus=Onlineregardless of preconditions. In real AWS, SSM registration requires an IAM instance profile grantingssm:UpdateInstanceInformation, and an instance with no profile never registers. Now only running instances with a profile are listed — so callers can distinguish a dead instance (no profile → can never register) from an SSM-managed one.Eligibility is profile presence (per the chosen approach): substrate doesn't model profile→policy attachment, and a missing profile is the actual dead-path signal the consumer tests. Time/agent-boot modeling is intentionally out of scope here.
Verification
TestEC2_DescribeInstances_EchoesIamInstanceProfile— with-profile echoes it, without-profile reports none.TestSSM_DescribeInstanceInformation_RequiresProfile— end-to-end via a combined EC2+SSM server: profile-bearing instance isOnline, profile-less instance never appears (dead path).make test(race) +make lintclean. AWS shapes (iamInstanceProfile>arn/id, the SSM registration precondition) verified against the EC2/SSM API references.Closes #331