Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete-function command doesn't respect AWS_DEFAULT_PROFILE variable #359

Closed
1 task
tolache opened this issue Jan 5, 2025 · 3 comments
Closed
1 task
Assignees
Labels
bug This issue is a bug. module/cli-ext p3 This is a minor priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@tolache
Copy link

tolache commented Jan 5, 2025

Describe the bug

If you are not using a default profile set in ~/.aws/config and rely on setting the AWS_DEFAULT_PROFILE environment variable to select the required profile, the dotnet lambda delete-function command will fail unless a profile is specified inline.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

The function is deleted successfully.

Current Behavior

dotnet lambda delete-function --function-name <my_function_name> produces output indicating an error:

Amazon Lambda Tools for .NET Core applications (5.12.3)
Project Home: https://github.com/aws/aws-extensions-for-dotnet-cli, https://github.com/aws/aws-lambda-dotnet

Error deleting Lambda function: Unable to get IAM security credentials from EC2 Instance Metadata Service.

Reproduction Steps

  1. Ensure that there is not default credentials in .aws/credentials.
  2. Set AWS_DEFAULT_PROFILE to <my_non_default_profile>.
  3. Ensure aws sts get-caller-identity works, i.e., provides output like
    {
        "UserId": "<my_user_id>",
        "Account": "<my_account_id>",
        "Arn": "arn:aws:iam::<my_account_id>:user/<my_non_default_profile>"
    }
    
  4. Deploy a function using dotnet lambda deploy-function.
  5. Try to delete the function using dotnet lambda delete-function --function-name <my_function_name>.

Possible Solution

The workaround is to specify the non-default profile inline:

dotnet lambda delete-function --function-name TunnelGPT --profile <my_non_default_profile>

Additional Information/Context

No response

AWS .NET SDK and/or Package version used

Amazon Lambda Tools for .NET Core applications (5.12.3)

Targeted .NET Platform

.NET 8

Operating System and version

Windows 11

@tolache tolache added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 5, 2025
@ashishdhingra ashishdhingra self-assigned this Jan 6, 2025
@ashishdhingra ashishdhingra transferred this issue from aws/aws-lambda-dotnet Jan 6, 2025
@ashishdhingra ashishdhingra added module/cli-ext needs-reproduction This issue needs reproduction. p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Jan 6, 2025
@ashishdhingra
Copy link
Contributor

@tolache Good afternoon. Thanks for opening the issue. AWS Extensions for .NET CLI tooling relies on AWS SDK for .NET for profile and credential resolution. Please refer AWS SDK for .NET: Credential and profile resolution, which mentions how AWS SDK for .NET resolves credentials where it does inspect AWS_PROFILE.

Environment variables supported by most SDKs are listed here.

Please share the following:

  • Have you tried using AWS_PROFILE environment variable?
  • Point us to reference where it states that AWS_DEFAULT_PROFILE environment variable should be supported.

Thanks,
Ashish

@ashishdhingra ashishdhingra added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. p3 This is a minor priority issue and removed needs-reproduction This issue needs reproduction. p2 This is a standard priority issue labels Jan 6, 2025
@tolache
Copy link
Author

tolache commented Jan 10, 2025

Confirmed: it works fine with the AWS_PROFILE environment variable. Sorry for the noise and thanks for looking into this, @ashishdhingra.

@ashishdhingra ashishdhingra closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2025
Copy link

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. module/cli-ext p3 This is a minor priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants