Search code examples
amazon-web-servicesamazon-elastic-beanstalkebcli

AWSeducate credentials are not accepted for Elastic Beanstalk ebcli


When I log into my awseducate account and I click on Account Details I get my credentials. See the credentials generated by the account

I successfully used these credentials with my S3 buckets to upload and download files. But when I try to use these credentials with elastic beanstalk service - ebcli (eb init command), I get the message ERROR: NotAuthorizedError - Operation Denied. The security token included in the request is invalid.

F:\cloud-developer-master\course-02\project\image-filter-starter-code>eb init

Select a default region
1) us-east-1 : US East (N. Virginia)
2) us-west-1 : US West (N. California)
3) us-west-2 : US West (Oregon)
4) eu-west-1 : EU (Ireland)
...
(default is 3): 1
You have not yet set up your credentials or your credentials are incorrect
You must provide your credentials.
(aws-access-id): ASIxxxxxxxxxxxxxxxxxxxxxxxx
(aws-secret-key): hVCExxxxxxxxxxxxxxxxxxxxxxx
ERROR: NotAuthorizedError - Operation Denied. The security token included in the request is invalid.

Any clues why these are not accepted?

NB: I can't create new crenditials with a new user because this operation is not allowed with this AWS Student account. I tried refereshing the page to get new credentials, still no success.

I tried creating the .aws/credentials file and copied and pasted those credentials, still not accepted:

F:\cloud-developer-master\course-02\project\image-filter-starter-code>eb init

Select a default region
1) us-east-1 : US East (N. Virginia)
2) us-west-1 : US West (N. California)
3) us-west-2 : US West (Oregon)
...
(default is 3): 1
ERROR: The current user does not have the correct permissions. Reason: Operation Denied. The security token included in the request is invalid.
ERROR: The current user does not have the correct permissions. Reason: Operation Denied. The security token included in the request is invalid.
You have not yet set up your credentials or your credentials are incorrect
You must provide your credentials.
(aws-access-id): ASIxxxxxxxxxxxxxxxxxxxxxxxxxxxx
(aws-secret-key): 1Ssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ERROR: NotAuthorizedError - Operation Denied. The security token included in the request is invalid.

Solution

  • Thanks to a guy that goes by the pseudo Gambit-, I found a solution to the problem (details here). You have to create two files in the folder: C:\Users\YOURUSERNAME\.aws

    config

    [default] 
    region = us-east-1 # replace this with your region (don't select it in the CLI) 
    output = json
    

    credentials

    [default]
    aws_access_key_id=REPLACE_WITH_YOUR_ACCESS_KEY
    aws_secret_access_key=REPLACE_WITH_YOUR_SECRET_KEY
    aws_session_token=REPLACE_WITH_YOUR_TOKEN
    

    A little explanation: When you select the region within the cmd, eb-cli will automatically update the config file by generating and storing a new profile named [eb cli] which will be populated with the information your select within the cmd. However, I did put the profile [default] in the file credentials which are two different profiles. Therefore, the authentication failed.

    Also, thanks John Rotenstein for your help