Explain it simpler
Programs that run in AWS need permission to touch other AWS things, like saving a file or reading a database row. Instead of giving a program a permanent password, AWS gives it a role: a badge with a list of allowed actions. The program borrows the badge and gets a short-lived pass that refreshes on its own. Each kind of compute has its own badge slot. Good practice is to put only the exact actions the program needs on the badge. When AWS decides yes or no, it starts at no, looks for a yes, and any written 'definitely not' beats every yes. It is like a building where your key card opens only your floor, and a 'closed for repairs' sign overrides any key card.
It is Tuesday afternoon at Lantern Freight, and Priya has just moved the shipment-tracking service from a laptop prototype to Amazon ECS on Fargate. The first container starts, the first request arrives, and the logs fill with AccessDeniedException every time the code tries to write to the Shipments table. She checks the console: the role she attached has full DynamoDB access. A teammate suggests pasting an access key into an environment variable just to get the demo working. Priya hesitates. The permissions look right, so why is AWS saying no, and is a hardcoded key really the only way out?
Applications need permissions just as people do, and AWS Identity and Access Management (IAM) provides them through roles. A role is an identity with permission policies but no long-term password or access keys. Whoever is allowed to assume it receives temporary credentials from the AWS Security Token Service (STS): an access key ID, a secret access key and a session token that expire and are refreshed automatically. Giving your code a role, rather than embedding an IAM user's access keys, is the pattern the exam expects every time, because temporary credentials cannot leak into a repository in a form that works forever, and there is nothing to rotate by hand.
Keep reading for free
Create a free StudyToCert account to read the rest of this lesson: 8 more sections, 8 key terms, a real-world example, an exam tip and self-check questions. Every lesson, lab and practice test is free with an account.