Skip to main content

DO NOT USE, THIS IS PRE-ALPHA, HAS NO TESTS

tc-sam-cli

A very simplified tool wrapped around aws-sam-cli to deploy aws lambda.

Works together with tclambda

Configuration

[Default]
StackName = "tc-sam-playground"
S3CodeBucket = "tc-sam-bucket"

[[ExtraPolicies]]
Effect = "Allow"
Action = ["dynamodb:*"]
Resource = "arn:aws:dynamodb:eu-west-1:1234:table/myTable"

[Functions.MyLambda]
CodeUri = "mylambda/"
Handler = "app.handler"
Runtime = "python3.7"
MemorySize = 256
Timeout = 60
ReservedConcurrentExecutions = 1
BatchSize = 10

[Functions.MyLambda.Environment]
MY_KEY = "my value"

[Functions.TcLambda.Events.Ping]
Schedule = "rate(1 minute)"
Function = "ping"

# More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
[Functions.TcLambda.Api.Webhook]
Path = "/hello"
Method = "post"


[Functions.Numpy]
CodeUri = "numpy/"
Handler = "app.handler"
Runtime = "python3.7"
MemorySize = 256
Timeout = 60
Tracing = true

Generate AWS SAM template

After every change in tc-sam.toml the template must be regenerated.

$ tc-sam generate_template > template.yml

It's recommended to have template.yml under source control.

Every Lambda has given access to each other's SQS Queue, and all Lambdas share the same S3 bucket for results.

Deploy

Deploy is very straightforward, it builds the sam package and deploys the cloudformation stack.

$ tc-sam deploy

Environmental export

$ tc-sam env_export
TC_NUMPY_QUEUE="https://sqs.eu-west-1.amazonaws.com/123/tc-sam-playground-NumpySqs-ABC"
TC_NUMPY_BUCKET="tc-sam-playground-resultbucket-123456"
TC_MYLAMBDA_QUEUE="https://sqs.eu-west-1.amazonaws.com/123/tc-sam-playground-TcLambdaSqs-ABC"
TC_MYLAMBDA_BUCKET="tc-sam-playground-resultbucket-123456"

These settings can be copied to other projects that will use the aws lambdas.

Ping all lambdas

The tclambda handler comes with a ping command to test if both permissions to SQS and S3 are allowed.

$ tc-sam ping
Ping NUMPY
Ping MYLAMBDA
Pong NUMPY
Pong MYLAMBDA

Metadata

Release files for tc-sam-cli 0.0.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tc-sam-cli 0.0.12
File Size Uploaded
tc-sam-cli-0.0.12.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tc-sam-cli 0.0.12
File Interpreter ABI Platform
tc_sam_cli-0.0.12-py3-none-any.whl Python 3 none any Details

Total release size: 16.4 kB

Release files / tc-sam-cli-0.0.12.tar.gz

Download URL tc-sam-cli-0.0.12.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e75fcc6a382b8c868bf959b05ad229fcb77188cc15a5db7035be9fa1654d3ce2
BLAKE2b-256 checksum
How to use checksums
948a3f3d05552e8fed20a8947128cfeb7f974a391373a652f7c03ed8afac3f57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.22.0

Release files / tc_sam_cli-0.0.12-py3-none-any.whl

Download URL tc_sam_cli-0.0.12-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af9ecb4cd28614494c75150367353cec9030e68b86ca3dbcaa223afffec9184b
BLAKE2b-256 checksum
How to use checksums
990d7baca1b7cfe7d585759c4d1670f712eedbf7172b3b9c67a5cca0596b2ef1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.22.0

Release history Release notifications | RSS feed

This release

0.0.12 This release

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page