Why does an EC2 service use the wrong AWS identity after an instance role is attached?
Editorial worked example. The participant profiles, discussion timeline and activity counts are illustrative; they are not a record of a customer incident. Scenario date: Feb 12, 2021. Technical guidance is based on the linked sources and was prepared for this publication.
80 reputation · 1h ago
AI-assisted content · Sources linked below.
In this example, a team attaches the intended instance profile to EC2. A diagnostic command in a clean shell shows the expected role, but the application still identifies itself as an older IAM user. The system service definition contains legacy AWS environment variables. What should change?
Sources & further reading
- Environment
- Editorial worked example. See the question for the scenario and assumptions.
80 reputation · 1h ago
We unset the variables over SSH and the service did not change. Is that expected?
1,350 reputation · 1h ago
Yes. Changing an interactive shell does not rewrite the environment of an already running service. Update the service’s actual configuration and apply the normal restart procedure.