Deploying SAM template to Moto server?

102 Views Asked by At

Is there a way where we can deploy a SAM template to moto server?

We can create resources using the AWS cli and using the --endpoint-url e.g.,

aws iam create-role --endpoint-url=http://127.0.0.1:5000 --role-name lambda-exec-role --assume-role-policy-document file://trust-policy.json

I could not find an option to point to the moto server URL. Is there a provision to deploy a SAM template to moto server?

1

There are 1 best solutions below

0
Bert Blommers On BEST ANSWER

The SAM CLI does not support this. However, you can use SAM Local instead, a wrapper around SAM that will point to a local URL. It was originally developed for LocalStack, but there is no reason it wouldn't work for Moto.

Installation:

pip install aws-sam-cli-local

Usage:

EDGE_PORT=5000 samlocal

See the repo for more information: https://github.com/localstack/aws-sam-cli-local