Javad Zahrabi

AWS CLI

Amazon Web Services command-line client (aws ...) — config, S3, EC2, EKS basics.

Official docs

Configure & identity

  • aws configure

    Interactive setup of the default profile (key, secret, region, output).

  • aws configure --profile work

    Set up a named profile alongside default.

  • aws sts get-caller-identity

    Who am I right now? Returns the account, ARN, user/role.

  • AWS_PROFILE=work aws sts get-caller-identity

    Use a named profile for one command without exporting.

  • aws configure list

    Show how each config value is being resolved (env vs profile vs file).

S3

  • aws s3 ls

    List buckets you can see.

  • aws s3 ls s3://my-bucket/path/

    List objects under a prefix.

  • aws s3 cp file.txt s3://my-bucket/path/

    Upload a file.

  • aws s3 cp s3://my-bucket/path/file.txt .

    Download a file.

  • aws s3 sync ./dist s3://my-bucket/site --delete

    Sync a local dir to a bucket prefix; --delete removes orphans.

  • aws s3 mb s3://new-bucket --region eu-central-1

    Make a new bucket.

EC2

  • aws ec2 describe-instances --output table

    List instances in the current region.

  • aws ec2 describe-instances --query "Reservations[].Instances[].[InstanceId,State.Name,Tags[?Key=='Name'].Value|[0]]" --output table

    Custom columns: id, state, Name tag.

  • aws ec2 start-instances --instance-ids i-0abcdef

    Boot a stopped instance.

  • aws ec2 stop-instances --instance-ids i-0abcdef

    Stop a running instance (charges stop, EBS storage charges continue).

  • aws ec2 describe-security-groups --output table

    Security groups in the current region.

EKS & IAM

  • aws eks list-clusters --output table

    EKS clusters in the current region.

  • aws eks update-kubeconfig --name my-cluster --region eu-central-1

    Merge an EKS cluster into ~/.kube/config.

  • aws iam list-users --output table

    IAM users.

  • aws iam list-roles --output table

    IAM roles.

  • aws iam get-role --role-name <role>

    Trust policy + creation metadata for a role.