question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Should sam local support named profiles created by aws cli v2 sso commands?

See original GitHub issue

Description

We have sam projects configured to start under a named profile. When that profile’s credentials are populated in the ~/.aws/credentials file, they are sent as expected in requests from sam local to aws resources.

However when the profile credentials are obtained by issuing an aws sso login command, using aws cli v2, they do not seem to get picked up. Calls from sam local functions to aws cloud resources are throwing an error

The security token included in the request is invalid.

Steps to reproduce

Remove named profile credentials from ~/.aws/credentials file

Obtain new credentials via the aws sso login command

Invoke sam local function that accesses an aws cloud resource like s3 or dynamodb

Observed result

Calls to aws cloud resources are rejected with a security token error.

Expected result

Calls to aws cloud resources behave the same as they do when the named profile credentials are obtained from a named profile defined in ~/.aws/credentials file.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: Windows, Mac
  2. sam --version: 0.38.0

Add --debug flag to command you are running

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:22
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
jplockcommented, Apr 10, 2020

Just ran into this as well. It would be great if I could pass the AWS CLI v2 generated profile name into SAM and have it work out of the box.

3reactions
bigwheelcommented, Apr 11, 2020

FYI: Im using linaro-its/aws2-wrap as workaround.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Should sam local support named profiles created by aws cli v2 ...
We have sam projects configured to start under a named profile. When that profile's credentials are populated in the ~/.aws/credentials file, ...
Read more >
Configuring the AWS CLI to use AWS IAM Identity Center ...
Automatically, using the aws configure sso and aws configure sso-session commands. Manually, by editing the config file that stores the named profiles.
Read more >
You only need to call`aws sso login` once for all your profiles
It turns out that the AWS CLI forces a refresh of the SSO token every time aws sso login , regardless of whether...
Read more >
How to setup AWS CLI with AWS SSO - CloudQuery
On your local machine, if you don't already have it, install AWS CLI v2. Configure an SSO Profile. Similar to the aws configure...
Read more >
check aws cli credentials
AWS CLI is a Command Line Interface designed for Amazon Web Services clients. You only need to call`aws sso login` once for all...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found