Tech & DevOps HubEspace Tech & DevOps

Explorez le monde du Dev, du Cloud et des outils DevOps à travers nos articles et discussions Explore the world of development, the cloud and DevOps tools
 FR      EN
Cloud(AWS, Azure, GCP)
AWS
List IAM access keys
aws iam list-access-keys --user-name devops-user

Shows active access keys associated with an IAM user.
output: { "AccessKeyMetadata": [ { "AccessKeyId": "AKIAxxx", "Status": "Active" } ] }
List EKS clusters
aws eks list-clusters

Retrieves the list of EKS clusters in the AWS account.
output: { "clusters": [ "dev-cluster", "prod-cluster" ] }
List recent CloudTrail events
aws cloudtrail lookup-events --max-results 5

Shows recent events recorded in AWS CloudTrail.
output: { "Events": [ { "EventName": "ConsoleLogin", "Username": "devops-user" } ] }
You can list recent CloudTrail events by using the Event history page in the AWS Management Console for the last 90 days or by using the `aws cloudtrail lookup-events` command in the AWS CLI.
List security policies
aws iam list-policies --only-attached

Lists security policies and attached resources.
output: { "Policies": [ { "PolicyName": "AdministratorAccess" } ] }
List IAM users
aws iam list-users

Lists all existing IAM users.
output: { "Users": [ { "UserName": "devops-user" } ] }
Check when the IAM keys (AWS) were last used
aws iam get-access-key-last-used --access-key-id AKIAxxx

Displays the last usage date of an IAM access key.
Useful for detecting unused or stale keys.
output: { "AccessKeyLastUsed": { "LastUsedDate": "2025-09-25" } }
Check IAM role permissions
aws iam list-attached-role-policies --role-name MyRole

Displays permissions attached to a specific IAM role.
output: { "AttachedPolicies": [ { "PolicyName": "AdministratorAccess" } ] }
Azure
List blobs in a container
az storage blob list --container-name mycontainer --output table

Lists all blobs inside an Azure Storage container.
output: Name BlobType Length backup.tar.gz BlockBlob 512000
List AKS clusters
az aks list --output table

Lists all AKS clusters in the Azure subscription.
output: Name Location ResourceGroup KubernetesVersion aks-prod westeurope RG-K8S 1.29.3
List audit logs
az monitor activity-log list --max-events 5

Displays Azure audit logs for security and operations.
output: Caller : admin@company.com Action : Microsoft.Resources/subscriptions/resourceGroups/delete
List assigned IAM roles
az role assignment list --assignee <principal-id>

Displays IAM roles assigned to a user or resource.
output: RoleDefinitionName : Owner Scope : /subscriptions/xxx
List privileged roles
az role assignment list --role "Owner"

Shows all privileged IAM roles in the tenant.
output: PrincipalName : admin@company.com Scope : /subscriptions/xxx
GCP
Switch kubeconfig context
gcloud container clusters get-credentials CLUSTER_NAME --zone europe-west1-b

Switches Kubernetes context to another GKE cluster.
output: Fetching cluster endpoint and auth data. Merged kubeconfig entries.
List GKE clusters
gcloud container clusters list

Retrieves all GKE clusters for the configured project.
output: NAME LOCATION MASTER_VERSION STATUS prod-cluster europe-west1-b 1.29.4-gke.200 RUNNING
List service accounts
gcloud iam service-accounts list

Lists service accounts in the current GCP project.
output: DISPLAY NAME EMAIL sa-monitoring monitoring@myproj.iam.gserviceaccount.com
List service account keys
gcloud iam service-accounts keys list --iam-account sa-monitoring@myproj.iam.gserviceaccount.com

Lists active keys linked to a service account..
output: KEY_ID CREATED_AT EXPIRES_AT 123abc456def 2025-01-12T08:00:00Z never
List bucket objects
gsutil ls gs://my-bucket

Lists all objects inside a Google Cloud Storage bucket.
output: gs://my-bucket/file1.txt gs://my-bucket/file2.log
Check user permissions
gcloud projects get-iam-policy my-project --flatten="bindings[].members" --format="table(bindings.role)" --filter="bindings.members:user:alice@company.com"

Shows effective IAM permissions for a GCP user.
output: ROLE roles/viewer roles/editor