Skip to content

Instantly share code, notes, and snippets.

View RajChowdhury240's full-sized avatar
💻
just another learner

Raj Chowdhury RajChowdhury240

💻
just another learner
  • Confidential
  • ::1
  • 03:30 (UTC +11:00)
View GitHub Profile
import boto3
import csv
import json
import threading
from botocore.exceptions import ClientError
from rich.console import Console
from rich.table import Table
# Initialize AWS Clients
org_client = boto3.client("organizations")

🛡️ IAM Policy Security Checklist (Least Privilege)

❌ Restriction ✅ Secure Alternative 🔍 Why?
iam:PassRole with Resource: "*" Restrict to specific roles Prevent privilege escalation
s3:Get* with Resource: "*" Use specific arn:aws:s3:::bucket-name & apply s3:ResourceAccount condition when * is needed Prevent broad S3 data access
sts:AssumeRole with Resource: "*" Restrict to specific trusted roles Prevent unauthorized cross-account access
kms:Get* Restrict to specific KMS keys Avoid unauthorized decryption
kms:CreateKey with Resource: "*" Require tagging conditions Enforce key management best practices
s3:PutObject without s3:x-amz-server-side-encryption Require encryption enforcement Ensure data confidentiality
import boto3
import csv
import time
from rich.console import Console
from rich.progress import Progress, TimeRemainingColumn, BarColumn
from rich.table import Table
ROLE_NAME = "ca-admin"
OUTPUT_CSV = "cloudwatch_alarms.csv"
import boto3
import json
import csv
import threading
from concurrent.futures import ThreadPoolExecutor, as_completed
from rich.progress import Progress, BarColumn, TimeRemainingColumn, SpinnerColumn
from rich.console import Console
from rich.table import Table
import boto3
import json
import csv
import time
import concurrent.futures
from botocore.exceptions import BotoCoreError, ClientError
from rich.console import Console
from rich.table import Table
from rich.progress import Progress, TimeRemainingColumn
import boto3
import json
import threading
import time
from botocore.exceptions import ClientError
from rich.progress import Progress, SpinnerColumn, TimeElapsedColumn
from rich.console import Console
from rich.table import Table
Action Pattern Condition to Check Allowed?
iam:PassRole Must not have Resource: "*" ❌ Not Allowed
s3:Get* Must not have Resource: "*" unless a condition is present ❌ Not Allowed
kms:Get* This action should not be present at all ❌ Not Allowed
kms:CreateKey If present, it must have a tagging condition (aws:RequestTag) ✅ Allowed (with condition)
iam:CreateRole Must not have Resource: "*" ❌ Not Allowed
iam:DeleteRole Must not have Resource: "*"

Darjeeling Trip Itinerary

Day 1: Arrival & Leisure

  • Arrive at Bagdogra Airport and take a cab to Darjeeling.
  • Check in to the hotel.
  • If we check in before 1 PM, head to Ghum Station for the toy train ride (8:00 AM, 10:40 AM, 1:40 PM, 4:10 PM).
  • Otherwise, relax at the hotel and explore Darjeeling Mall Road in the evening.
import boto3
import json
import csv
import threading
from rich.progress import Progress, BarColumn, TimeRemainingColumn, SpinnerColumn
from rich.console import Console
from rich.table import Table
AWS_REGION = "us-east-1"
ACCOUNT_ID = "590183941608"
import boto3
import json
import csv
import os
import threading
from concurrent.futures import ThreadPoolExecutor, as_completed
from rich.progress import Progress, TimeRemainingColumn, BarColumn, SpinnerColumn
from rich.console import Console
from rich.table import Table