einaregilsson / beanstalk-deploy

GitHub action (and command line script) to deploy apps to Elastic Beanstalk
MIT License
614 stars 133 forks source link

Use of `aws_session_token` #65

Closed giraz82 closed 2 years ago

giraz82 commented 2 years ago

I'm trying to use a temporary access token with:

  uses: einaregilsson/beanstalk-deploy@v17
  with:
      aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
      aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
      aws_session_token: ${{ github.event.inputs.session_token }}

But I get:

Error: Deployment failed: Error: Status: 403. Code: InvalidClientTokenId, Message: The security token included in the request is invalid.

I also printed out ${{ github.event.inputs.session_token }} just to be sure the string is correctly managed by GitHub runner. With eb cli I can access of course.

Any idea? Thank you.

giraz82 commented 2 years ago

I'm closing because after refreshing secrets, it works. I leave it since could help someone that is starting to use this action with temporary tokens.

krajeswaran commented 2 years ago

I'm closing because after refreshing secrets, it works.

@giraz82 Can you please explain - how/what did you refresh? Revoked sessions in IAM or created new AWS Secrets?

I'm stuck on the same error message and would like some help. Thanks!

slomangino123 commented 2 years ago

@giraz82 @krajeswaran Did you guys ever figure this out I'm stuck using aws-actions/configure-aws-credentials@v1 which sets the environment variable AWS_SESSION_TOKEN then defining aws_session_token: ${{ env.AWS_SESSION_TOKEN }} in this and it does not seem to work. Looking for suggestions.

bdoughertycloudbeds commented 2 years ago

aws-actions/configure-aws-credentials@v1 seems to set the access key/secret for the temporary token as process.env vars. So referring to them like this worked for me:

aws_access_key: ${{ env.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ env.AWS_SECRET_ACCESS_KEY }}