Hi, Trying to Run Serverless Deploy within a Bitbucket Pipeline but i keep getting Error:``The security token included in the request is invalid.
- step:
name: Assume Role and Deploy to Sandbox
image: amazon/aws-cli
oidc: true
script:
- export AWS_REGION=eu-west-1
- export AWS_ROLE_ARN=arn:aws:iam:::role/ssm-bitbucket-automation
- export AWS_WEB_IDENTITY_TOKEN_FILE=$(pwd)/web-identity-token
- echo $BITBUCKET_STEP_OIDC_TOKEN > $(pwd)/web-identity-token
- >-
CREDS=$(aws sts assume-role-with-web-identity --role-arn arn:aws:iam:::role/ssm-bitbucket-automation --role-session-name ssm-bitbucket-automation --web-identity-token “$BITBUCKET_STEP_OIDC_TOKEN” --duration-seconds 1000 | jq -r ‘.Credentials’)
- export AWS_ACCESS_KEY_ID=$(echo $CREDS | jq -r ‘.AccessKeyId’)
- export AWS_SECRET_ACCESS_KEY=$(echo $CREDS | jq -r ‘.SecretAccessKey’)
- export AWS_SESSION_TOKEN=$(echo $CREDS | jq -r ‘.SessionToken’)
- pipe: atlassian/serverless-deploy:1.5.0
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
EXTRA_ARGS: ‘–stage sandbox --region eu-west-1’