Open noahsmartin opened 2 years ago
@noahsmartin serverless shows the prompt only per AWS SDK request (it's not decided individually by the Framework), so there won't be the case where AWS SDK is fine with obtained credentials, and yet Framework without a reason asks for MFA code.
Nonetheless, we're aware of issues in handling AWS credentials, and we have a dedicated issue to tackle that: https://github.com/serverless/serverless/issues/9290
Are you certain it's a bug?
Is the issue caused by a plugin?
Are you using the latest version?
Is there an existing issue for this?
Issue description
My IAM users require using MFA to assume a role that allows access to most aws resources. This works with serverless by setting the
AWS_PROFILE
env variable and includingin
~/.aws/credentials
With this setup serverless will prompt for an MFA code:
This role has a maximum session duration of 1 hour, configured in the AWS console. With the AWS CLI this means I only need to authenticate MFA once an hour, but serverless is prompting for the mfa code on every command. Seems like it should respect the session duration and avoid prompting for new codes.
Service configuration (serverless.yml) content
Command name and used flags
sls package
Command output
Environment information