Powershell Functions in AWS SAM Local

AWSTemplateFormatVersion : '2010-09-09'Transform: AWS::Serverless-2016-10-31
Resources:
VoteSpacesTabs:
Type: "AWS::Serverless::Function"
Properties:
Runtime: python3.8
Handler: lambda_function.lambda_handler
Policies: AmazonDynamoDBFullAccess
Environment:
Events:
Vote:
Type: Api
Properties:
Path: /
Method: get
import os
import json
def lambda_handler(event, context):
print(event)
return {'body': "testing!"}
AWSTemplateFormatVersion : '2010-09-09'Transform: AWS::Serverless-2016-10-31
Resources:
VoteSpacesTabs:
Type: "AWS::Serverless::Function"
Properties:
Runtime: dotnetcore3.1
CodeUri: ./src/MyFunction/
Handler: MyFunction::MyFunction.Function::FunctionHandler
Policies: AmazonDynamoDBFullAccess
Environment:
Events:
Vote:
Type: Api
Properties:
Path: /
Method: get
New-AWSPowerShellLambda -ScriptName MyFirstPSScript -Template Basic
#Requires -Modules @{ModuleName='AWS.Tools.Common';ModuleVersion='4.0.5.0'}write-host "Hello world!!!";Write-Host (ConvertTo-Json -InputObject $LambdaInput -Compress -Depth 5);
# throw "this is an exception!";
return "hello world!";
New-AWSPowerShellLambdaPackage -ScriptPath .\MyFirstPSScript.ps1 -OutputPackage myfirstscripts.zip
AWSTemplateFormatVersion : '2010-09-09'Transform: AWS::Serverless-2016-10-31
Resources:
VoteSpacesTabs:
Type: "AWS::Serverless::Function"
Properties:
Runtime: dotnetcore3.1
CodeUri: myfirstscript
Handler: MyFirstPSScript::MyFirstPSScript.Bootstrap::ExecuteFunction
Policies: AmazonDynamoDBFullAccess
Environment:
Events:
Vote:
Type: Api
Properties:
Path: /
Method: get
Resources:
VoteSpacesTabs:
Type: AWS::Serverless::Function
Properties:
Timeout: 300
Runtime: dotnetcore3.1
.....

Should you do this

--

--

--

Engineer, formerly at Amazon, currently at Google. All opinions are my own. Consider supporting here: https://devblabs.medium.com/membership

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

LXD for newbies

Async programming in Shiny plus Spinners

Pedantic Semantics

Play custom push notification sound iOS

Kotlin Komparisons : Login Settings

Scrum — Team work!

Running SQL Syntax on a Python DataFrame

Implement Computer Vision on remote live camera feed using WebRTC

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Brian Olson

Brian Olson

Engineer, formerly at Amazon, currently at Google. All opinions are my own. Consider supporting here: https://devblabs.medium.com/membership

More from Medium

AWS Lambda Python: Forcing the Lambda Sandbox to Timeout

Archiving DynamoDB TTL Items with Streams and Lambda

Optimize memory usage in AWS Lambda (.NET) with a simple fix

AWS Amplify Pitfalls and Solutions