All Cheat SheetsExplore Deep Dive Guide
Explore Deep Dive Guide
Explore Deep Dive Guide
Explore Deep Dive Guide
Explore Deep Dive Guide
Explore Deep Dive Guide
Explore Deep Dive Guide
IAM & Security Cheat Sheet
Multi-cloud reference for AWS, Azure, and Google Cloud IAM & Security services
IAM & Security — Multi-Cloud Cheat Sheet
Cloud Arena | cloudarena.com
AWS IAM
AWSKey Commands & CLI Operations
| Command | Description | |
|---|---|---|
| aws iam create-role --role-name LambdaProcessorRole --assume-role-policy-document file://trust-policy.json | Create IAM Role with trust policy | |
| aws iam attach-role-policy --role-name LambdaProcessorRole --policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole | Attach managed execution policy | |
| aws sts assume-role --role-arn arn:aws:iam::123456789012:role/DeployRole --role-session-name GithubCI | Obtain temporary STS session credentials | |
| aws iam generate-service-last-accessed-details --arn arn:aws:iam::123:role/AppRole | Audit unused permissions via Access Advisor |
Architectural Key Facts
- •Global identity and access governance system providing authentication and authorization for AWS resources.
- •Policy evaluation logic: Explicit Deny always takes absolute precedence over any Allow; implicit deny by default.
- •IAM Roles issue temporary credentials (`ASIA...`) via AWS Security Token Service (STS), eliminating hardcoded secrets.
- •Permission Boundaries set the maximum permissible permissions an identity can have; vital for safe delegated role creation.
- •Service Control Policies (SCPs) in AWS Organizations enforce guardrails across multi-account organization units.
Production Limits & Quotas
| Item / Dimension | Limit / Quota |
|---|---|
| Roles per account | 5,000 roles (soft limit) |
| Managed policies attached to a role | 10 managed policies (expandable to 20) |
| STS assumed role session duration | 15 minutes to 12 hours |
AWS KMS
AWSKey Commands & CLI Operations
| Command | Description | |
|---|---|---|
| aws kms create-key --description 'Production Database CMK' --key-usage ENCRYPT_DECRYPT --origin AWS_KMS | Provision Customer Managed Key (CMK) | |
| aws kms generate-data-key --key-id alias/prod-db --key-spec AES_256 | Envelope encryption: Generate 256-bit plaintext & ciphertext DEK | |
| aws kms encrypt --key-id alias/prod-db --plaintext fileb://secret.txt --output text --query CiphertextBlob | Direct KMS encrypt (for small payloads <4KB) | |
| aws kms enable-key-rotation --key-id KEY_ID | Enable automatic annual cryptographic key rotation |
Architectural Key Facts
- •Hardware-backed encryption service using FIPS 140-2 Level 3 cryptographic modules (HSMs).
- •Implements Envelope Encryption: KMS protects Data Encryption Keys (DEKs); clients encrypt data locally with DEKs.
- •Key Policies are the primary access control mechanism; without explicit delegation in the Key Policy, IAM policies cannot grant access.
- •Multi-Region Keys share the same key ID and key material across regions to decrypt data globally without cross-region network calls.
- •Every cryptographic API call is recorded immutably in AWS CloudTrail for compliance audits.
Production Limits & Quotas
| Item / Dimension | Limit / Quota |
|---|---|
| Direct encrypt payload limit | 4,096 bytes (4 KB; use envelope encryption for larger) |
| Cryptographic requests per second | 5,500 to 50,000 req/s depending on region (auto-scaling) |
| Key policy size limit | 32 KB |
AWS Secrets Manager
AWSKey Commands & CLI Operations
| Command | Description | |
|---|---|---|
| aws secretsmanager create-secret --name prod/db/credentials --secret-string '{"username":"admin","password":"ComplexP@ss1"}' | Store encrypted credentials | |
| aws secretsmanager get-secret-value --secret-id prod/db/credentials --query SecretString --output text | Retrieve plaintext secret string | |
| aws secretsmanager rotate-secret --secret-id prod/db/credentials --rotation-lambda-arn ARN --rotation-rules AutomaticallyAfterDays=30 | Configure automated 30-day rotation |
Architectural Key Facts
- •Dedicated secrets lifecycle management service designed to store database passwords, API tokens, and private keys.
- •Built-in automated rotation for Amazon RDS, Aurora, DocumentDB, and Redshift using predefined AWS Lambda functions.
- •4-step zero-downtime rotation lifecycle: `createSecret`, `setSecret`, `testSecret`, and `finishSecret` with version staging labels.
- •Client-side caching libraries (Python, Java, Go) store secrets in memory to prevent API throttling and reduce costs.
- •Multi-Region Secret replication synchronizes credentials across disaster recovery regions automatically.
Production Limits & Quotas
| Item / Dimension | Limit / Quota |
|---|---|
| Max secret value size | 65,536 bytes (64 KB) |
| GetSecretValue API rate limit | 10,000 requests/sec (use client caching) |
| Resource policy size limit | 20,480 bytes (20 KB) |
AWS WAF & Shield
AWSKey Commands & CLI Operations
| Command | Description | |
|---|---|---|
| aws wafv2 create-web-acl --name WebSecurityACL --scope REGIONAL --default-action Allow={} --rules file://waf-rules.json --visibility-config SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=WebACL | Create regional Web ACL for ALB/API Gateway | |
| aws wafv2 associate-web-acl --web-acl-arn ACL_ARN --resource-arn ALB_ARN | Attach Web ACL to Application Load Balancer | |
| aws shield describe-protection --protection-id PROT_ID | Check AWS Shield Advanced protection status |
Architectural Key Facts
- •AWS WAF operates at Layer 7 (HTTP/HTTPS) inspecting traffic at CloudFront edge POPs, ALBs, and API Gateways.
- •AWS Managed Rules (AMR) provide out-of-the-box protection against OWASP Top 10 vulnerabilities, botnets, and CVEs.
- •Rate-based rules track client request frequencies in sliding windows (1m, 2m, 5m) to mitigate application-layer DDoS.
- •Web ACL capacity is governed by Web ACL Capacity Units (WCUs); default budget is 1,500 WCUs per ACL.
- •AWS Shield Standard provides automatic Layer 3/4 DDoS protection free; Shield Advanced adds 24/7 SRT and cost surge protection.
Production Limits & Quotas
| Item / Dimension | Limit / Quota |
|---|---|
| Default WCU capacity limit | 1,500 WCUs per Web ACL (expandable to 5,000) |
| Max request body inspection | Up to 64 KB for regional resources (ALB/API Gateway) |
| Rate-based rule minimum threshold | 10 requests per evaluation window |
Microsoft Entra ID (Azure AD)
AzureKey Commands & CLI Operations
| Command | Description | |
|---|---|---|
| az ad user create --display-name 'Jane Doe' --user-principal-name jane@company.onmicrosoft.com --password 'InitialP@ss1' | Provision new cloud directory user | |
| az role assignment create --assignee jane@company.onmicrosoft.com --role 'Contributor' --scope /subscriptions/SUB_ID/resourceGroups/myrg | Assign Azure RBAC role at Resource Group scope | |
| az identity create -g myrg -n app-managed-id | Create User-Assigned Managed Identity for VM/Container | |
| az ad app create --display-name 'Microservice-API' | Register application with OAuth2/OIDC endpoint |
Architectural Key Facts
- •Cloud-based identity and access management service handling user authentication, single sign-on (SSO), and resource authorization.
- •Azure Role-Based Access Control (RBAC) grants fine-grained permissions at Management Group, Subscription, Resource Group, or Resource scope.
- •Managed Identities eliminate credentials in code; Azure automatically injects short-lived tokens into VMs, App Services, and Functions.
- •Conditional Access policies enforce multi-factor authentication (MFA), compliant device checks, and risk-based blocking.
- •Privileged Identity Management (PIM) provides just-in-time (JIT) access with mandatory approval workflows and audit trails.
Production Limits & Quotas
| Item / Dimension | Limit / Quota |
|---|---|
| Role assignments per subscription | 4,000 role assignments |
| Directory objects (Free tier) | 500,000 objects |
| Custom RBAC roles per directory | 5,000 custom roles |
Azure Key Vault
AzureKey Commands & CLI Operations
| Command | Description | |
|---|---|---|
| az keyvault create -g myrg -n prod-vault-101 --location eastus --enable-purge-protection true --retention-days 90 | Provision Key Vault with purge protection | |
| az keyvault secret set --vault-name prod-vault-101 -n DbPassword --value 'SecretDatabaseValue1!' | Store secure secret string | |
| az keyvault secret show --vault-name prod-vault-101 -n DbPassword --query value -o tsv | Retrieve secret value programmatically | |
| az keyvault key create --vault-name prod-vault-101 -n DiskEncryptionKey --kty RSA --size 4096 | Create 4096-bit RSA cryptographic key |
Architectural Key Facts
- •Centralized, secure cloud store for safeguarding application secrets, cryptographic encryption keys, and TLS/SSL certificates.
- •Hardware Security Module (HSM) backing ensures FIPS 140-2 Level 2 (Standard) and Level 3 (Premium/Managed HSM) compliance.
- •Soft Delete (retains deleted vaults/secrets for 7-90 days) and Purge Protection prevent accidental or malicious deletion.
- •Azure RBAC for Key Vault allows granting fine-grained permissions (Key Vault Secrets User) using standard Azure IAM policies.
- •Native integration with Azure App Service, Azure Functions, and AKS via CSI Secret Store Driver.
Production Limits & Quotas
| Item / Dimension | Limit / Quota |
|---|---|
| Max secret value size | 25 KB per secret |
| API transaction rate limit | Up to 25,000 transactions per 10 seconds per vault |
| Certificate auto-renewal | Supported via integrated certificate authorities |
Azure DDoS Protection & WAF
AzureKey Commands & CLI Operations
| Command | Description | |
|---|---|---|
| az network ddos-protection create -g myrg -n ddos-plan --location eastus | Create Azure DDoS Network Protection plan | |
| az network vnet update -g myrg -n prod-vnet --ddos-protection true --ddos-protection-plan ddos-plan | Associate DDoS plan with Virtual Network |
Architectural Key Facts
- •Provides defense against large-scale distributed denial-of-service (DDoS) attacks at Layer 3, Layer 4, and Layer 7.
- •DDoS Network Protection continuously profiles application traffic patterns and automatically applies mitigations during volumetric floods.
- •DDoS Cost Protection provides SLA credits for scaling costs incurred by protected VMs during an active DDoS attack.
- •Azure Web Application Firewall (WAF) inspects Layer 7 HTTP requests against OWASP core rule sets (CRS 3.2), bot managers, and custom rules.
- •Deep integration with Azure Monitor delivers real-time attack telemetries, mitigation notifications, and forensic reporting.
Production Limits & Quotas
| Item / Dimension | Limit / Quota |
|---|---|
| Protected public IP addresses | Up to 100 public IPs included per DDoS plan |
| WAF custom rules limit | Up to 100 custom rules per WAF policy |
IAM Basics
Google CloudKey Commands & CLI Operations
| Command | Description | |
|---|---|---|
| gcloud projects add-iam-policy-binding PROJECT_ID --member=user:email@example.com --role=roles/viewer | Grant role to user | |
| gcloud projects get-iam-policy PROJECT_ID | View project IAM policy | |
| gcloud projects remove-iam-policy-binding PROJECT_ID --member=user:email@example.com --role=roles/viewer | Revoke role |
Architectural Key Facts
- •IAM policies are attached to resources (Org, Folder, Project, Resource) and define 'Who has What access to Which resource'.
- •Permissions are inherited downwards: Org -> Folder -> Project -> Resource.
- •Primitive roles (Owner, Editor, Viewer) affect all resources in a project; avoid using them in production.
- •Predefined roles provide granular access to specific services (e.g., roles/compute.instanceAdmin).
- •Custom roles can be created for specific permission combinations if predefined roles don't fit.
Production Limits & Quotas
| Item / Dimension | Limit / Quota |
|---|---|
| Max principals per policy binding | 1,500 |
| Max custom roles per project | 300 |
| Max conditional bindings per policy | 250 |
Roles
Google CloudKey Commands & CLI Operations
| Command | Description | |
|---|---|---|
| gcloud iam roles describe roles/viewer | View permissions in a role | |
| gcloud iam roles create customRole --project=PROJECT_ID --title='Custom Role' --permissions=compute.instances.list | Create custom role | |
| gcloud iam list-testable-permissions //cloudresourcemanager.googleapis.com/projects/PROJECT_ID | List permissions available to test |
Architectural Key Facts
- •A Role is a collection of permissions; you cannot assign a permission directly to a user, only roles.
- •Custom roles cannot be created at the Folder level (only Org or Project level).
- •IAM Recommender suggests removing over-permissive roles based on actual usage over 90 days.
- •Audit logs (Admin Activity) record whenever IAM policies are changed.
Production Limits & Quotas
| Item / Dimension | Limit / Quota |
|---|---|
| Max permissions per custom role | 3,000 |
| Role ID length | 64 characters |
Service Accounts
Google CloudKey Commands & CLI Operations
| Command | Description | |
|---|---|---|
| gcloud iam service-accounts create my-sa --display-name='My Service Account' | Create a Service Account | |
| gcloud iam service-accounts keys create key.json --iam-account=my-sa@PROJECT.iam.gserviceaccount.com | Generate JSON key | |
| gcloud iam service-accounts add-iam-policy-binding my-sa@PROJECT.iam.gserviceaccount.com --member='user:email@example.com' --role='roles/iam.serviceAccountUser' | Allow user to impersonate SA |
Architectural Key Facts
- •A Service Account is an identity for applications/VMs, not humans.
- •It acts as both an Identity (can be granted roles) and a Resource (users can be granted roles on the SA to use it).
- •Best practice: Use Service Account Impersonation or Workload Identity Federation instead of downloading JSON keys.
- •Default compute service account has the broad 'Editor' role; it's recommended to disable or restrict it.
Production Limits & Quotas
| Item / Dimension | Limit / Quota |
|---|---|
| Max service accounts per project | 100 (can request quota increase) |
| Max keys per service account | 10 |