AWS IRSA (IAM Roles for Service Accounts)

A comprehensive guide to AWS IRSA implementation and workflow

Featured image



Overview

Today, we’ll explore AWS IRSA (IAM Roles for Service Accounts) and understand how it enables secure AWS service access for pods running in EKS clusters.


What is AWS IRSA?

AWS IAM Roles for Service Accounts (IRSA) is a method of granting access to AWS services using ServiceAccount on a pad running on a Kubernetes cluster managed by AWS EKS (Elastic Kubernetes Service).

So how can I allocate an IAM Role when ServiceAccount is not a resource for AWS?

OpenID Connect, called OIDC, and the Security Token Service, called STS, perform the function.

Key Components
  • Kubernetes ServiceAccounts
  • AWS IAM Roles
  • OpenID Connect (OIDC)
  • Security Token Service (STS)


What is OIDC(OpenID Connect)?

OpenID Connect (OIDC) is an authentication protocol built on OAuth 2.0 that allows users to authenticate with a third-party service using their existing accounts.

It extends OAuth 2.0 authorization to provide user information in addition to tokens.

Create and Verify EKS OIDC Provider


What is ServiceAccount?

ServiceAccount is a Kubernetes resource that represents a service account, which is an identity for an application or a user.

It is used to manage access to resources within a Kubernetes cluster.

Create IAM Role and ServiceAccount


What is STS(Security Token Service)?

STS is a service that provides temporary security credentials for AWS resources.

It is used to manage access to AWS resources securely.


🔄 IRSA Workflow

Example Workflow (Pod accessing S3)
  1. Pod sends JWT and IAM Role ARN to AWS STS
  2. STS requests verification from IAM
  3. IAM verifies with OIDC Provider
  4. IAM confirms authorization to STS
  5. STS provides temporary credentials to Pod
  6. Pod accesses S3 using temporary credentials

IRSA Workflow


Key Components Explained

OIDC (OpenID Connect)

AWS STS (Security Token Service)

JWT (JSON Web Token)



References