amazon-web-servicesconfigaws-clitemp

configure temp aws cli user still existing a default cli user


How can I configure a temporary AWS-CLI user if I already have a default user in the .aws/ path ??? if I could create a temp user, I could test my task without interfering default user !!


Solution

  • You can add temp user as follows:

    export AWS_ACCESS_KEY_ID=<your AWS_ACCESS_KEY_ID >
    export AWS_SECRET_ACCESS_KEY=<your AWS_SECRET_ACCESS_KEY>
    export AWS_REGION=<your AWS_REGION>
    

    When you set these values, you will be able to see similar like these:

    {
        "Account": "2*********4", 
        "UserId": "A*****************V", 
        "Arn": "arn:aws:iam::275*******04:user/s3ba*****ser"
    }
    

    Once you are done, do the rest :

    unset AWS_ACCESS_KEY_ID
    unset AWS_SECRET_ACCESS_KEY
    unset AWS_REGION