aws-lambda-dotnet icon indicating copy to clipboard operation
aws-lambda-dotnet copied to clipboard

Documentation missing for PowerShell Containers on AWS Lambda

Open pcgeek86 opened this issue 3 years ago • 7 comments

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

pcgeek86 avatar Mar 06 '21 16:03 pcgeek86

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

ashishdhingra avatar Mar 08 '21 22:03 ashishdhingra

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?

normj avatar Mar 12 '21 18:03 normj

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.

pcgeek86 avatar Mar 12 '21 21:03 pcgeek86

+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.

JustinGrote avatar Mar 12 '21 23:03 JustinGrote

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 avatar Feb 01 '22 11:02 nickadam

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. 🤞

nickadam avatar Feb 04 '22 21:02 nickadam

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

JustinGrote avatar Feb 04 '22 22:02 JustinGrote