apx-aws-lambda
Deploy to AWS Lambda from Action Platform with no AWS key anywhere.
Deploying to AWS usually means a long-lived access key in a CI secret, or a role wired by hand for every repository. apx-aws-lambda is the Action Platform plugin that removes the key: AWS itself trusts the platform's OIDC tokens through an IAM-only connect stack in your account, so that no AWS key ever lives on the platform, on a machine or in a repository — and nothing of ours runs in the account. apx- is the prefix every Action Platform extension carries.
What you get
- The
aws/lambdadeploy target (SAM).deploy,rollback,diagnoseanddestroyfor a project, with every linesamprints streamed to the platform's run log. - One overlay for every language.
template.yaml,samconfig.toml, a one-lineMakefile,requirements/(IAM examples) and an optional.github/workflows/deploy.yml. The Lambda Web Adapter layer runs the project as an HTTP server on$PORT, so everyweb/*template of the official repository deploys. - Keyless credentials. A connected account (the connect stack), a role of your own through OIDC, or the AWS CLI's own chain. The token's session tag keeps each deploy inside its app, and a permissions boundary caps every execution role.
- Readiness before anything is built. The platform checks credentials, stack state, the deploy role's permissions (simulated with
iam:SimulatePrincipalPolicy) andsam validate --lintafter every release, and refuses a blocked deploy unless forced. - Deployment strategies.
recreate,canary,blue_greenandrolling(as linear) on Lambda versions and the aliaslive's weighted routing, with CloudWatch health checks. - Read-only tools.
aws_lambda_stacksandaws_lambda_functionsfor MCP, andaction-platform aws-lambda connect|stacks|functionsfor the terminal.
Install
action-platform plugin install aws-lambda
action-platform cloud set aws/lambda # overlay files come from this plugin
action-platform deploy --dry-run # preflight: credentials, sam validate
action-platform deploy # sam build + sam deploy --config-env <stage>
action-platform diagnose
On a hosted platform an instance owner installs the plugin first, under Admin → Plugins. Requires action-platform 0.32.0 or newer; the Requirements section lists the rest.
Contents
- What the plugin does
- Credentials without keys
- Deployment strategies
- Where the deploy runs
- Tools and commands
- Requirements
- Development
- How it fits in Action Platform
- Contributing
- License
What the plugin does
| Overlay | template.yaml, samconfig.toml, a one-line Makefile (ap-build package), requirements/ (IAM examples), .github/workflows/deploy.yml (optional). One template for every language: the Lambda Web Adapter layer runs the project as an HTTP server on $PORT — run.sh from ap-build (Python python3.14, Node nodejs26.x, Java/Kotlin java25, Ruby ruby3.3) or bootstrap on provided.al2023 (Go and Rust static binaries, PHP with a static PHP CLI behind php -S, C# a self-contained dotnet publish). Every web/* template of the official repository deploys; the health route is /health (API Gateway keeps /ping for itself on execute-api). Template parameters the target fills: Stage (the scope's name), and for a connected account PermissionsBoundaryArn and RolePath |
| Readiness | before a deploy, without building or changing anything: the tooling is there, the app's template is not one the overlay excludes (web/go/grpc: gRPC needs HTTP/2 on its own port, and API Gateway HTTP API serves HTTP/1.1 only), the overlay is applied, the stack name resolves, the app's language version runs on the overlay's runtime (runtime.<language>: Python from .python-version or requires-python, Node from .nvmrc or engines.node, Java from .java-version, the pom or the Gradle toolchain, .NET from global.json or TargetFramework against the .NET 10 SDK, Ruby from the Gemfile or .ruby-version; a newer one blocks the deploy), the credentials work, the stack is not mid-operation or failed (a failed first creation — ROLLBACK_COMPLETE or ROLLBACK_FAILED — is a warning: the deploy deletes it), the overlay takes a connected account's boundary and role path, the deploy role may do what the template needs (simulated with iam:SimulatePrincipalPolicy against the stack, the function, its log group, the execution role and every public layer the template references — the Lambda Web Adapter's, for one) and sam validate --lint passes. The platform runs it after every release for each of the app's scopes and refuses a blocked deploy unless forced; action-platform readiness runs it on a machine. A stack its own pipeline deploys (an observed target) skips the credentials and permissions checks, since that pipeline deploys with another identity; its state is read only when an identity can read it |
| Deploy | sam build (ap-build sam-build where make is missing, as on Windows) + sam deploy --config-env <stage> (scope prod → prod, any other → default). A stack left by a failed first creation (ROLLBACK_COMPLETE, ROLLBACK_FAILED) is deleted first; when that delete fails on a resource that was never created, the stack is deleted again with it retained. On a connected account, an overlay without PermissionsBoundaryArn and RolePath stops the deploy before the build. Every line sam prints reaches the platform's run log as it appears — the deploy form, the run dialog, action-platform logs -f |
| Rollback | CloudFormation rollback-stack — previous stack state |
| Diagnose | stack status and the HTTP API url |
| Destroy | sam delete of the stage's stack, the execution role SAM created with it |
| Tools | aws_lambda_stacks, aws_lambda_functions |
| Commands | action-platform aws-lambda connect|stacks|functions |
[deploy] in platform.toml:
[deploy]
target = "aws/lambda"
region = "us-east-1" # optional; samconfig.toml / AWS_REGION otherwise
health = "/health" # optional; checked through the HTTP API after the deploy, "" skips it
Deploying itself goes through the core's deploy / rollback / diagnose, which drive the target.
Credentials without keys
The target looks for credentials in this order:
Under [deploy] |
How | Who decides what the app may do |
|---|---|---|
role_arn |
sts assume-role-with-web-identity with a platform token |
the role's trust and permission policies |
neither, and the organization's AWS account ID (or deploy role ARN) set on the platform (Connect → Deploy → AWS Lambda), which every deploy job carries as AP_AWS_LAMBDA_ROLE_ARN with AP_APP |
sts assume-role-with-web-identity on the connect stack's role with the platform's token for the app |
the token's session tag and the role's policy, in your account |
| neither | the AWS CLI's own chain: SSO, profile, instance role | whatever that identity may do |
A connected account (recommended)
One CloudFormation stack, IAM only — no function, no table, nothing to upgrade. AWS itself trusts the platform's OIDC tokens; the token's session tag keeps each deploy inside its app.
1. Create the stack — once per AWS account, with an IAM user or role that may create IAM resources (not the root account). On the platform: Connect → Deploy → AWS Lambda → Configure → Connect AWS (an instance owner installs the plugin first, under Admin → Plugins). The button copies a command and opens AWS CloudShell, behind the AWS sign-in; paste the command and press Enter. It downloads this release's connect/template.yaml from GitHub, deploys it as the stack action-platform-connect in us-east-1 with the platform's url and the organization's slug, and prints the account ID.
Without the button, the same stack from a machine logged in to the account:
action-platform aws-lambda connect https://platform.example.com acme # --region, --stack-name, --oidc-provider-arn
or in the console: CloudFormation → Create stack → Upload a template file → apx_aws_lambda/connect/template.yaml, parameters IssuerUrl (the platform's public url), Organization (its slug) and, optionally, Organizations (more slugs, comma separated), acknowledge IAM.
2. Tell the platform — Connect → Deploy → AWS Lambda → Configure → AWS account ID = the 12 digits the command printed (the stack's DeployRoleArn output works too). Every app of the organization whose platform.toml says target = "aws/lambda" deploys from then on; nothing to register per app.
What the stack creates:
| Resource | Purpose |
|---|---|
| IAM OIDC provider | trusts IssuerUrl for audience sts.amazonaws.com; pass OidcProviderArn when the account already has one for the platform |
ActionPlatformAppBoundary (/action-platform/) |
the cap on every execution role an app's stack creates — logs /aws/lambda/<prefix>*; S3 buckets, DynamoDB tables, SQS queues, SNS topics, Lambda functions <prefix>-*; Secrets Manager secrets and SSM parameters <prefix>/*; X-Ray — <prefix> being the role's action-platform:prefix tag. An app's own template.yaml still declares what its function needs; the boundary caps it |
ActionPlatformDeploy role (/action-platform/) |
trust: AssumeRoleWithWebIdentity for sub org:<org>:* of every trusted organization, and TagSession only for the one tag action-platform:prefix with a value ap-<org>-*. Policy: every resource under ${aws:PrincipalTag/action-platform:prefix} — CloudFormation stacks, Lambda, logs; API Gateway; the public Lambda Web Adapter layers; SAM's bucket; Amplify Hosting apps and branches tagged with the app's prefix, and their deployments and jobs (for aws/amplify); IAM on roles under the path /action-platform/<prefix>/ only — iam:CreateRole with the boundary attached and the app's own prefix tag, iam:PassRole to Lambda only; iam:SimulatePrincipalPolicy on itself |
How a deploy runs: the platform signs a token for the app with the claim https://aws.amazon.com/tags → principal_tags.action-platform:prefix = ap-<org>-<app>; the target assumes the deploy role with it, names the stack ap-<org>-<app>-<scope> and the function <stack>-api, passes PermissionsBoundaryArn and RolePath=/action-platform/<prefix>/ to the overlay's template and tags the stack with the prefix, so the execution role SAM creates carries the boundary and the tag and lives under the app's path. The path, not the name, tells an app's roles apart: CloudFormation cuts a generated role name to 64 characters, which can drop the prefix from it. sam delete removes that role with the stack. Who may deploy which app is the platform's decision — it only signs a token for an app the job or the caller is for.
Names: the organization, app and scope slugs are always whole, and the project is not in them. A name that would pass a limit of what the overlay creates is refused, naming that limit: the Lambda function <stack>-api (64 characters, the tightest), the stack and the HTTP API (128), the log group /aws/lambda/<stack>-api (512). The organization is never shortened either: ap-<org>- is what the trust's TagSession condition and every prefix-scoped policy match, and a shortened organization would land inside another organization's names in a shared account.
A stack made before keeps its name, ap-<org>-<project>-<app>-<scope> fitted within 60 characters: for such a scope the platform signs the old prefix, and the target names the stack from the tag it gets. Moving it to the new name is the platform's Migrate name rollout.
Tags: every deploy tags the stack — and through it every resource that takes stack tags — with Name, action-platform:organization, :project, :app, :scope, :release (the version deployed, set again on every deploy), :repository, :managed-by=action-platform and :prefix. The overlay's template sets the same tags on the HTTP API and its custom domain, which stack tags do not reach, and the function's description <app> (<project>) · <scope> · managed by Action Platform, from the ActionPlatform* parameters the target passes; for an overlay from before them, the target tags the HTTP API and its domain and sets the description after the deploy, and only warns when it cannot.
Readiness simulates the deploy role with the session tag, the boundary and iam:PassedToService as context entries, and flags an overlay without the PermissionsBoundaryArn or RolePath parameter. An app whose overlay predates them applies it again: Configuration → Deploy target, or action-platform cloud set aws/lambda. The stack's policy is the one place to widen or narrow what deploys may do.
Updating the connect stack
The command pins the template to the plugin's release. After the platform moves to a plugin whose connect template changed, run Connect AWS again (or action-platform aws-lambda connect …): CloudFormation updates action-platform-connect in place, and the account ID stays the same.
Several organizations in one account
One AWS account can deploy for more than one organization on the same platform. The stack trusts Organization plus every slug in Organizations, as lists in the role's sub and TagSession prefix conditions. Connect AWS from a second organization reads the slugs the stack already trusts and passes them back in Organizations, so connecting it keeps the first; action-platform aws-lambda connect does the same unless --organizations names them.
Amplify Hosting gives tag conditions on apps and branches only: deployments and jobs (CreateDeployment, StartDeployment, ListJobs, GetJob) are allowed on any app's branch in the account, since AWS offers no condition to scope them.
A role of your own (OIDC)
Instead of the connect stack, register the platform as an identity provider once per account and write the trust policy yourself:
aws iam create-open-id-connect-provider --url https://platform.example.com --client-id-list sts.amazonaws.com
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Principal": { "Federated": "arn:aws:iam::123456789012:oidc-provider/platform.example.com" },
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringEquals": { "platform.example.com:aud": "sts.amazonaws.com" },
"StringLike": { "platform.example.com:sub": "org:acme:project:shop:app:orders" }
}
}]
}
requirements/policy.json from the overlay is a starting permission policy. Then:
[deploy]
target = "aws/lambda"
role_arn = "arn:aws:iam::123456789012:role/shop-deploy"
sub is org:<org>:project:<project>:app:<app> for a deploy the platform runs; org:<org> plus an actor claim for action-platform deploy from a logged-in machine (StringLike with org:acme:* covers both).
The AWS CLI's own credentials
With neither role_arn nor a connected account, aws and sam use what the machine has: aws sso login, a profile, an instance role. Still no key in a file when you use SSO — but nothing ties the identity to one app.
Deployment strategies
The overlay publishes the function through the alias live (AutoPublishAlias: live), and the HTTP API invokes that alias. The target answers the core's strategy operations with Lambda versions and the alias's weighted routing:
| Operation | What it does |
|---|---|
deploy_new |
the regular deploy, then — below weight 100 — the alias is put back on the version that was serving, with the new version at weight 0 (AdditionalVersionWeights) |
shift / replace |
the new version gets weight% of the invocations; 100 points live at it and clears the routing |
retire_old |
clears the routing; with retain_versions under [deploy], deletes the oldest versions beyond that many |
rollback |
points live back at the version that was serving (the previous published one after a full shift) and clears the routing |
health |
CloudWatch Errors and Throttles of the new version over the last health_window seconds against max_errors and max_throttles, and the health route through the HTTP API when the stack has a url |
status |
the version live serves and the routing weights |
recreate, canary, blue_green and rolling (as linear) run on it. shadow does not: it needs mirror, and an alias splits invocations between versions but cannot copy them.
[deploy]
retain_versions = 5 # optional; delete older versions at retire_old. Unset keeps them all
max_errors = 0 # optional; errors tolerated in the window
max_throttles = 0 # optional
health_window = 300 # optional; seconds of CloudWatch data
The CloudFormation update moves live to the new version before deploy_new puts it back, so the new version can serve for the seconds between the two; a deploy that fails its health route is put back as well.
Migrating an existing install
- The stack,
TemplateVersion4. Adds explicit tagging under the prefix conditions:cloudformation:TagResource/UntagResourceon the app's stacks,lambda:TagResource/UntagResource/ListTagson its functions,logs:TagResource/UntagResource/TagLogGroup/ListTagsForResourceon its log groups, API Gateway tags andtag:TagResourcesonly with the app's own prefix tag in the request,tag:UntagResourcesfor any tag but the prefix, andamplify:TagResourcesplit fromamplify:CreateAppso it reaches only apps and branches that already carry the app's prefix (before, a request carrying its own prefix could retag any Amplify app). A stack atTemplateVersion3 still deploys: the role'slambda:*,logs:*,cloudformation:*andapigateway:*on the app's resources already cover the tags. - Each app, for the labels. Apply the overlay again to get the HTTP API's tags and the function's description declared in the template; until then the target sets them after each deploy.
- The stack,
TemplateVersion3. AddsOrganizations(default empty, so an update needs no new input) and the Amplify Hosting actionsaws/amplifyuses. - The stack. Update the connect stack (
TemplateVersion2): it addscloudwatch:GetMetricStatisticstoActionPlatformDeploy, whichhealthneeds. Lambda actions on versions and the alias are already inside the role'slambda:*on the app's functions. - Each app. Apply the overlay again (Configuration → Deploy target, or
action-platform cloud set aws/lambda) and deploy once: the template gains the alias and the HTTP API starts invoking it, an ordinary stack update. Until then the strategy operations answer that the function has nolivealias, and a plain deploy works as before. - Your own role (
role_arn): addcloudwatch:GetMetricStatistics(seerequirements/policy.json).
Where the deploy runs
Independent of how credentials are obtained:
| Where | Token for the role comes from |
|---|---|
| the platform's worker (a deploy job) | signed by the platform for that app: sub = org:…:project:…:app:…, the action-platform:prefix session tag |
a logged-in machine (action-platform deploy) |
POST /api/v1/identity/token with the user's login: sub = org:<org>, actor, scopes |
the overlay's .github/workflows/deploy.yml |
GitHub's own OIDC — optional, unrelated to the platform; delete the workflow when the platform deploys |
Tools and commands
aws_lambda_stacks / action-platform aws-lambda stacks [prefix] |
CloudFormation stacks |
aws_lambda_functions / action-platform aws-lambda functions [prefix] |
Lambda functions |
action-platform aws-lambda connect <platform url> <organization> |
the connect stack, in the account the CLI is logged in to |
Requirements
awsandsam— on PATH when present; otherwise theawscliandaws-sam-clipackages the plugin depends on run aspython -m, which is how the hosted platform deploys without the CLIs in its image.AWS_REGIONorregionunder[deploy].- Network:
*.amazonaws.com. - Connecting the account: credentials for it that may create IAM resources, once — AWS CloudShell through the Connect AWS button, the console, or
awsforaction-platform aws-lambda connect. action-platform0.32.0 or newer: the Connect AWS button is an option action of the core.
Windows
A deploy from Windows (PowerShell, no make, no WSL) works without changes: where make is missing and ap-build is on PATH, the target runs ap-build sam-build in place of sam build. It is the same ap-build package the overlay's Makefile runs on the platform's worker, laid out as sam build leaves it, so sam deploy follows as usual. By hand:
pip install aws-sam-cli "ap-build @ git+https://github.com/actionplatform/images-base@v0.5.0"
ap-build sam-build
sam deploy
The overlay's DEPLOY.md covers the languages whose dependencies cannot be cross-built from Windows (the language's build image through Docker) and the IAM steps in PowerShell. CI renders the overlay on the Python and Node templates on windows-latest, with neither sh nor make on PATH, builds it with ap-build sam-build, zips it the way sam deploy does and runs sam validate --lint on the built template.
Development
pip install -e ".[dev]"
pytest
The tests fake aws and sam; nothing reaches AWS.
| Module | Responsibility (ABC in abc.py) |
|---|---|
lambda_.py |
LambdaTarget: the core's DeployTarget contract, composing the parts below through parts(spec, access) |
spec.py |
Spec: samconfig, stack, region and — for a connected account — prefix, deploy role, boundary, resolved once per call without calling AWS |
credentials.py |
Credentials: OwnRole ([deploy] role_arn), ConnectedAccount, CliChain — which identity aws and sam act as |
stack.py |
Stack: the CloudFormation stack — status, outputs, clearing a failed first creation, rollback |
sam.py |
Sam: build, deploy, delete, validate |
health.py |
Health: the function answers its health route after the deploy |
checks.py |
Readiness: one class per check |
shell.py |
running aws and sam, streaming sam's output to the job log |
tools.py, cli.py |
read-only views for MCP and the terminal; connect |
How it fits in Action Platform
Action Platform turns scaffold, CI, versioning and deploy into one set of verbs — init, release, readiness, deploy, rollback, diagnose — on a CLI, a web app and an MCP server. Everything cloud-specific is a plugin: this one is the aws/lambda deploy target behind the core's deploy / rollback / diagnose, and the platform runs its readiness checks after every release. The plugin is listed in plugins-index; apx-example is the template for writing another one.
Contributing
Git-flow branches (<kind>/<issue>-slug), Conventional Commits and one pull request per change, as in the main repository's guide. See Development for the test setup.
License
Apache 2.0 — see LICENSE.
Metadata
Release files for apx-aws-lambda 1.13.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| apx_aws_lambda-1.13.0.tar.gz | 78.0 kB | With provenance | Details for apx_aws_lambda-1.13.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| apx_aws_lambda-1.13.0-py3-none-any.whl | Python 3 | none | any | Details for apx_aws_lambda-1.13.0-py3-none-any.whl |
Total release size: 140.4 kB
Release files / apx_aws_lambda-1.13.0.tar.gz
| Download URL | apx_aws_lambda-1.13.0.tar.gz |
|---|---|
| Size | 78.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db8daabbe0b29906852fb18edf5b73d91bed911a1b1f3a95275b8a4cbf774a8b
|
|
BLAKE2b-256 checksum How to use checksums |
557021be91cc32c7839fd0951cdc2ab04cbd32b9dfc6d54cd5e9d7c2f455d21a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logRelease files / apx_aws_lambda-1.13.0-py3-none-any.whl
| Download URL | apx_aws_lambda-1.13.0-py3-none-any.whl |
|---|---|
| Size | 62.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fd96da2cf40ff1ad206267ada06850b3f9d4ff5a0c3caeba1ea595f74779c511
|
|
BLAKE2b-256 checksum How to use checksums |
4c9f4c6c86856c561b65b307501f403bdcff2241c439a93a5f4ca504f0238cdf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logSecurity for apx-aws-lambda 1.13.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for apx_aws_lambda-1.13.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.