windowsbashamazon-web-servicescommand-promptaws-cli

How do i access AWS SAM-CLI through bash on windows?


I am running Windows 10 and can only access AWS SAM through command prompt but not bash. When i try to use bash, i get a bash: sam: command not found error.

If it helps, I currently have installed AWS CLI v2 and have installed it via an MSI file.

Why am i not able to use SAM through bash?

Edit: Yes i am aware that it doesnt explicitly say that you can use bash on the AWS setup guide

Verify the installation. After completing the installation, verify it by opening a new command prompt or PowerShell prompt. You should be able to invoke sam from the command line.

However, I still want to be able to use it through bash. Is there a workaround?


Solution

  • Do you tried sam.cmd?

    Sometimes bash don't know how to execute .cmd files. Here is a thread with this problem.

    You can try this solution too:

    alias sam='sam.cmd'