Design Secure Architectures
30% of the examWhat this topic covers
Choose IAM roles and instance profiles for secure AWS access without long-lived keys. Protect applications and data with controls such as private subnet egress through NAT gateways and scoped S3 permissions.
Why use an EC2 instance profile instead of access keys in application code?
An instance profile gives the instance temporary credentials for its attached IAM role, so no long-lived access keys are stored on the server. AWS rotates these credentials automatically, and a replacement instance gets its own role credentials without manual key copying. Keep the role's policy limited to the actions the app needs.