AWS
DevOps
  • knowledge
    • glossary
    • network knowledge
      • CIDR Block
      • OSI
      • List of Ports
      • Network model
    • AWS best practices
      • Least privilege principle
      • Support Plan
      • Well-architected framework
        • Well-architected framework
        • Cost optimization
        • Operational Excellence
        • Performance efficiency
        • Reliability
        • Security
    • Exams
      • DOP-C02
        • DOP-C02 topics
        • DOP-C02 Labs
      • DVA-C02
      • SOA-C02
  • services
    • access management
      • Directory Service
      • IAM
        • PassRole
      • IAM Identity Center (SSO)
      • Organizations
        • Organizational Unit
        • Control Tower
      • AD Domain Service
    • analytics
      • data analytic
        • Athena
        • QuickSight
        • Redshift
      • data collection
        • Data Lake
        • Lake Formation
      • data processing
        • EMR
        • Kinesis
        • Glue
          • Glue Data Catalog
      • OpenSearch
    • compute
      • Batch
      • EC2
        • Auto Scaling
        • AMI
        • ELB
          • Global accelerator
        • Security Group
        • EBS
        • EC2 Instance Store
        • Spot Fleet
      • Elastic Beanstalk
      • Lambda
        • Layer
        • Lambda API
      • Outposts
      • Wavelength
      • SAM
      • VMWare Cloud
    • container
      • Copilot
      • ECR
      • ECS
        • ECS Anywhere
      • EKS
        • EKS Anywhere
        • EKS Distro
      • Fargate
    • cost management
      • Budgets
      • Cost Explorer
      • Saving Plans
      • Compute Optimizer
    • database
      • Data Engineer
      • Document DB
      • DynamoDB
        • DynamoDB API
        • Scan
      • ElastiCache
      • Keyspaces
      • MemoryDB for Redis
      • Neptune
      • Quantum Ledger Database
      • RDS
        • Aurora
          • Aurora Global Database
          • Aurora Serverless
      • Timestream
    • devTools
      • CICD
        • CodeArtifact
        • CodeCommit
        • CodeBuild
        • CodeDeploy
        • CodePipeline
      • CloudFormation
      • CodeGuru
      • CodeStar
      • CodeWhisperer
      • X-Ray
      • Deployment strategies
    • finance
      • Cost explorer
    • integration
      • AppFlow
      • AppSync
      • EventBridge
      • MQ
      • SNS
      • SQS
      • Step Functions
      • SWF
    • management
      • AppConfig
      • AWS Backup
      • AWS CDK
      • Config
      • Grafana
      • Health Dashboard
      • Proton
      • Service Catalog
      • System Manager
      • SSM
      • Resource Group
      • OpsWorks (discontinued)
    • media
      • Elemental MediaConvert
      • Transcoder
    • messaging
      • SES
    • migration
      • Application Migration Service
      • DataSync
      • DMS
      • Migration Evaluator
      • Migration Hub
      • Server Migration Service
      • Snow Family
      • Transfer Family
    • ML
      • Comprehend
      • Forecast
      • Kendra
      • Lex
      • Rekognition
      • SageMaker
        • SageMaker Data Wrangler
        • SageMaker ML Lineage Tracking
    • monitoring
      • CloudTrail
      • CloudWatch
      • TrustedAdvisor
    • networking
      • CloudFront
      • Customer gateway
      • Edge Location
      • hybrid networking
        • Direct Connect
          • Direct Connect Gateway
        • Site-to-site VPN
      • PrivateLink
      • Region
        • AZ
      • Route 53
      • Transit Gateway
      • VPC
        • VPC Lattice
        • Subnet
          • NACL
        • Internet Gateway
        • Network Firewall
        • VPN
        • NAT Gateway
      • Virtual Private Gateway
    • security
      • Artifact
      • ACM
      • CloudHSM
      • Cognito
      • Detective
      • Firewall Manager
      • GuardDuty
      • Inspector
      • KMS
      • Macie
      • Network Firewall
      • Resource Access Manager
      • Security Hub
      • Secret Manager
      • Secret Hub
      • Shield
      • STS
      • Trusted Advisor
      • WAF
    • storage
      • Backup
      • EBS
      • EFS
      • FSx
      • S3
        • S3 Glacier
        • S3 Snippet
        • S3 Mountpoint
      • Snow family
      • Storage gateway
      • WorkDocs
    • web & mobile
      • Amplify
      • API Gateway
      • Device Farm
      • Pinpoint
Powered by GitBook
On this page
  • Overview
  • IAM
  • IAM policy
  • IAM provision workflow
  • Other policies
  • Features
  • Permission boundary
  • Policy evaluation logic
  • IAM Access Analysis
  • IAM credentials report
  • Use cases
  • Best practices
  • Top-10 security items to improve your AWS account
  • Security best practices
  • Trivia
  1. services
  2. access management

IAM

Identity and Access Management

PreviousDirectory ServiceNextPassRole

Last updated 1 year ago

Overview

IAM

  • Free global service.

  • Help you manage access to services, and resources.

  • IAM entities:

    • IAM Groups: contain users

    • IAM Users: a person, or service

    • IAM Federated users: Amazon, Facebook, Google, Twitter users.

    • IAM Roles:

      temporary permission to interact with resources.

      • A role do not have long-term credentials.

      • It has 1-many relationship with users or applications.

      • Cross account access in different environment. Ex: Same user want to access both dev and prod environment. So by assume different role, that user can access prod without creating new identity.

IAM policy

  • JSON document used to define ALLOW/DENY permissions.

  • There are 3 types of policies: AWS managed, inline and Customer managed.

AWS access levels

Syntax

  • In JSON policy, a statement consist of EAR (basic structure)

    • Effect: ALLOW or DENY

    • Action: Get, Put, Write...

    • Resource

    • Principal: AWS account/user/role to which the policy apply to.

    • Conditional (optional): when this policy effect.

  • IAM policy example

    • Can you create a SQS queue?

      • No because there's an explicit deny.

    • Can you delete a SQS queue?

      • No because there's an explicit deny on top which precedes the allow.

    • Can you create an EC2 instance?

      • There's no explicit deny or allow. Since everything in AWS is deny by default so no.

IAM provision workflow

Other policies

4 types of policy

  • Identity-based

  • Resource-based

  • Organization SCPs

  • Access control lists (ACLs)

    • If has 1 or more DENY, than the result is DENY

    • If nobody is ALLOW, then the result is also DENY.

IAM Roles vs Resource-based policies

  • When you assume role, you give up original permission of your principal and take the new ones given by the role.

  • When using resouce-based policy, you DON'T have to give up permission of your principal.


Features

Permission boundary

  • The maximum permission that you can grant to an IAM entity.

Policy evaluation logic

IAM Access Analysis

Benefits

  • Quickly analyze thousands of resource policies

  • Continuously monitors and helps you refine permissions

  • Provides the highest levels of security assurance

    • identify which resources grant public or cross-account access.

How it works?

  1. Step1: Create an analyzer -> continuously scans the policies.

  2. Step2: Review your findings

  3. Step3: Take action: modify the policy.

IAM credentials report

List all your IAM users and status of their various credentials.


Use cases

  • Grant permissions, create users, groups or roles in the tenant

  • Manage per-account access, or multi-account access (IAM Identity Center)

  • Verify right-size permission (least priviledge principle)

  • Control how user access AWS

    • Using SSL?

    • Which IP address?

    • Time of day

    • Authenticated user only

    • Multi-factor authentication device.

  • Integrate with corporate directory


Best practices

Top-10 security items to improve your AWS account

  • Using temporary credentials

  • Use MFG

  • Rotate access keys

  • Don't user root account for anything except Billing

  • Use IAM Access Analyzer to generate least-privilege policies based on access activity

  • Regularly review and remove unused users, roles, permissions, policies, and credentials

  • Use permissions boundaries: set maximum permissions


Trivia

  • IAM user and IAM group are for people. IAM Roles are for machines and services.

  • Groups cannot belong to other groups. NO nesting.

  • CANNOT add role to a group. Only users and services can assume a role to take on permissions.

  • IAM policy process in top-down order. If there a DENY above an ALLOW statement for the same permission, the ALLOW statement does not processed -> In IAM policies, an explicit "Deny" overrides an "Allow".

  • Add condition key aws:PrincipalOrgID to resource-based policy if you want to allow all AWS accounts from the organization to access that resource.

IAM role & Resource-based policies
IAM policy evalution logic flow

Security

Apply

If you want to manage multiple AWS account, use (AWS SSO)

best practices
least-privilege principle
IAM Identity Center
How a service assume role
AWS services's actions
common workflow
grant employees access to AWS resources