vim ~/.aws/config
[profile dev]
sso_session = dev
sso_account_id = XXXXXXXXXXXX
sso_role_name = AdministratorAccess
region = eu-west-1
output = json
[sso-session dev]
sso_start_url = https://sso-link.awsapps.com/start#
sso_region = eu-west-1
sso_registration_scopes = sso:account:access
PS: The config file has to be updated base on your aws setup
export AWS_PROFILE=dev && aws sso login --sso-session ${AWS_PROFILE}
eval "$(aws configure export-credentials --profile ${AWS_PROFILE} --format env)" \
&& aws configure set aws_session_token ${AWS_SESSION_TOKEN} --profile ${AWS_PROFILE} \
&& aws configure set aws_access_key_id ${AWS_ACCESS_KEY_ID} --profile ${AWS_PROFILE} \
&& aws configure set aws_secret_access_key ${AWS_SECRET_ACCESS_KEY} --profile ${AWS_PROFILE}
serverless deploy --stage ${AWS_PROFILE} --verbose