aws / aws-lambda-dotnet

Libraries, samples and tools to help .NET Core developers develop AWS Lambda functions.
Apache License 2.0
1.56k stars 480 forks source link

Documentation missing for PowerShell Containers on AWS Lambda #823

Open pcgeek86 opened 3 years ago

pcgeek86 commented 3 years ago

I was going through the documentation for AWS Lambda and noticed that there isn't any documentation for PowerShell Containers on Lambda. According to the Lambda Containers announcement, all Lambda runtimes are supported with containers. Is that true for PowerShell?

I also tried to run pwsh from the "dotnet" container image on the AWS public ECR gallery. It doesn't appear to be installed in the dotnet image, so how would I package up a PowerShell container for Lambda?

PS > docker run --rm -it --entrypoint sh public.ecr.aws/lambda/dotnet
sh-4.2# ls
sh-4.2# dotnet

Usage: dotnet [options]
Usage: dotnet [path-to-application]

Options:
  -h|--help         Display help.
  --info            Display .NET information.
  --list-sdks       Display the installed SDKs.
  --list-runtimes   Display the installed runtimes.

path-to-application:
  The path to an application .dll file to execute.
sh-4.2# pwsh
sh: pwsh: command not found

Notice how the documentation for Lambda Containers skips over PowerShell, but exists for other languages, in the following screenshot.

image

ashishdhingra commented 3 years ago

Hi @pcgeek86,

Good morning.

Please use Provide feedback at the bottom of the page to submit missing documentation feedback. That being said, I don't think PowerShell is supported by default in Lambda containers. I will try to get more information on this issue and may be check with developer as well.

Thanks, Ashish

normj commented 3 years ago

We haven't built a PowerShell base image yet for Lambda. I like the idea and hope we can we prioritize it. So anybody else that wants this feature please +1 this issue.

Out of curiosity for PowerShell users, is requiring Docker for a PowerShell Lambda experience a significant hurdle to using PowerShell on Lambda?

pcgeek86 commented 3 years ago

Out of curiosity for PowerShell users, is requiring Docker for a PowerShell Lambda experience a significant hurdle to using PowerShell on Lambda?

No, it's not a significant hurdle. Publishing PowerShell Lambda functions is fairly straightforward with the AWSLambdaPSCore.

That being said, I would love to NOT have to worry about installing this module separately, and simply build a standard Dockerfile, just like every other programming language.

JustinGrote commented 3 years ago

+1 a standard module would be ideal, especially the boilerplate since the current implementation is basically just a C# application that calls a powershell script, rather than a first-party powershell implementation.

nickadam commented 2 years ago

Out of curiosity for PowerShell users, is requiring Docker for a PowerShell Lambda experience a significant hurdle to using PowerShell on Lambda?

@normj significant hurdle. PSWSMan (required by ExchangeOnlineManagement) attempts to overwrite shared object files on the read only volume. At this point, our best option is to build our own container image, and it would be nice to have a starting point.

nickadam commented 2 years ago

After attempting to implement this myself I think I understand why there isn't a container image ready to go. There are some drawbacks to simply running a vanilla powershell process and I suspect there is a lot happening during the compilation of the zip along with optimizations in the runtime to account for those drawbacks. I'll plan on using this until something better comes along, https://github.com/nickadam/powershell-lambda. 🤞

JustinGrote commented 2 years ago

Out of curiosity for PowerShell users, is requiring Docker for a PowerShell Lambda experience a significant hurdle to using PowerShell on Lambda?

@normj significant hurdle. PSWSMan (required by ExchangeOnlineManagement) attempts to overwrite shared object files on the read only volume. At this point, our best option is to build our own container image, and it would be nice to have a starting point.

While not fixing the issue, the latest Exchange preview module 2.0.6 proxies a ton of new commands through HTTPS, no pssession needed. https://techcommunity.microsoft.com/t5/exchange-team-blog/exchange-online-powershell-v2-module-preview-now-more-secure/ba-p/2922946