Describe a situation where you might use an AWS CLI profile, and how would you go about creating and using one?

I would use an AWS CLI profile when managing multiple AWS accounts or IAM users, such as separate development and production environments. Profiles allow me to store multiple sets of credentials and configurations locally without overwriting the default settings.

To create a profile:

aws configure --profile dev

This stores the credentials and region information for the dev profile. I can then run commands against that account by specifying:

aws ec2 describe-instances --profile dev

or set the profile as the active one using the AWS_PROFILE environment variable. This helps prevent accidental changes in the wrong AWS account and simplifies administration across multiple environments.

Sormak, cevaplamak, paylaşmak, beğenmek ve oy vermek için lütfen giriş yapın.