/cicd-tooling-skills:complete-cicd-pipeline-deployment-for-serverless-from-scratchfrom cicd-tooling-skills
Builds a complete CI/CD pipeline for an AWS Lambda function from scratch: source checkout, zip/layer packaging, SCA/SAST security gates, package upload, and alias-based canary traffic shifting deploy.
Ships in cicd-tooling-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A serverless pipeline's build artifact and deploy mechanics are both
fundamentally different from the Kubernetes and VM variants of this skill:
the build step produces a zip archive or a set of Lambda layers, not a
container image or a machine image, and the deploy step is the
pipeline's final action — there is no separate in-cluster operator to hand
off to. Traffic shifting during rollout is done via a weighted alias
pointing at two published function versions, not a Kubernetes Service
selector flip or a percentage-weighted Rollout/Canary CR. This skill
sequences source → zip/layer packaging → SAST/SCA → package upload → an
alias-based canary deploy into one coherent walkthrough; the individual
packaging and IAM mechanics are covered in depth elsewhere and only
sequenced here.
zip + console upload, and the
user wants it automated end-to-end with security gates and a safe
traffic-shift rollout.CreateFunction/UpdateFunctionCode/alias API
calls; examples below use SAM (sam build/sam deploy) since it's the
most directly AWS-native, with a Serverless Framework note where the
shape differs.Standard PR/push trigger setup per ci-cd-pipeline-design.
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with: { python-version: "3.12" }
- run: |
pip install -r requirements.txt -t package/
cp -r src/* package/
cd package && zip -r ../function.zip . -x '*.pyc'
- uses: actions/upload-artifact@v4
with: { name: function-package, path: function.zip }
There is no Dockerfile, no base-image choice, and no multi-stage build
here — contrast directly with Phase 2 of the Kubernetes variant of this
skill. Shared/common dependencies used across multiple functions become a
separately-versioned Lambda layer (its own zip, published once, mounted
at /opt on every consuming function) rather than a shared base image
layer, per
aws-lambda-packaging-and-configuration.
Function dependency trees bundled directly into the zip (all of
node_modules/site-packages, not just what a slim container runtime
image would carry) are frequently the largest attack-surface component of
a serverless package — scan the packaged dependency tree, not just the
application's own source:
sast:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- run: semgrep ci --config p/owasp-top-ten --baseline-commit "${{ github.event.pull_request.base.sha }}"
sca:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with: { name: function-package }
- run: |
unzip function.zip -d unpacked/
trivy fs --severity CRITICAL,HIGH --exit-code 1 unpacked/
Scanning the unpacked, fully-resolved package (after pip install -t/
npm ci --omit=dev) rather than only the top-level requirements.txt/
package.json is what catches vulnerable transitive dependencies that
ended up bundled into the deployed artifact.
aws s3 cp function.zip s3://payments-api-artifacts/${GITHUB_SHA}/function.zip
SAM/Serverless Framework typically wrap this upload internally as part of
sam deploy/serverless deploy; shown explicitly here since the
artifact-upload step is itself part of what differs from a container
pipeline's registry push.
sam build
sam deploy \
--stack-name payments-api \
--s3-bucket payments-api-artifacts \
--capabilities CAPABILITY_IAM \
--no-confirm-changeset
sam deploy (via CloudFormation) publishes a new immutable Lambda
version on each deploy — versions, not the mutable $LATEST, are what
aliases and traffic-shifting target, per
aws-lambda-packaging-and-configuration.
This is the serverless-specific rollout mechanic: instead of a Service
selector flip or a percentage-weighted Rollout CR routing between pods,
Lambda shifts a percentage of invocations between two published
function versions under one alias, either via SAM's built-in
AutoPublishAlias/DeploymentPreference (which wraps CodeDeploy) or
directly with CodeDeploy's Lambda traffic-shifting hooks — the same
CodeDeploy engine covered for EC2/ECS in
aws-codepipeline-and-codedeploy,
applied to its Lambda deployment type instead:
# template.yaml (SAM)
Resources:
PaymentsApiFunction:
Type: AWS::Serverless::Function
Properties:
AutoPublishAlias: prod
DeploymentPreference:
Type: Canary10Percent5Minutes
Alarms:
- !Ref PaymentsApiErrorAlarm
Hooks:
PreTraffic: !Ref PreTrafficHookFunction
PostTraffic: !Ref PostTrafficHookFunction
Canary10Percent5Minutes shifts 10% of invocations to the new version for
5 minutes, running PreTraffic/PostTraffic Lambda hook functions to
validate before/after each shift, and automatically rolls back to the
prior version if PaymentsApiErrorAlarm (a CloudWatch alarm on error
rate) fires during the canary window — no cluster, no pods, no Service
object involved anywhere in this mechanism.
aws lambda get-alias --function-name payments-api --name prod
aws cloudwatch describe-alarms --alarm-names payments-api-error-rate
Confirm the alias's RoutingConfig.AdditionalVersionWeights has returned
to empty (fully cut over) or that a rollback reverted FunctionVersion
back to the prior value, depending on outcome.
$LATEST in
production, mirroring the immutable-tag discipline in
container-build-and-release
but for function versions instead of image tags.DeploymentPreference's Alarms list — a canary with no alarm attached
will complete the traffic shift on a timer regardless of whether the new
version is actually healthy.lambda:UpdateFunctionCode, cloudformation:* on the specific
stack ARN) — never a broad lambda:*/iam:* role "to make SAM deploy
work."PreTraffic/PostTraffic hook functions for real smoke tests
(invoke the new version directly, verify output) rather than leaving
them as no-op stubs — an empty hook that always returns success defeats
the canary's safety purpose.Symptom: The team copies a Kubernetes-style pipeline template,
builds a Docker image for the function, and pushes it to a container
registry — then can't figure out why the Lambda deploy step fails.
Fix: Lambda supports container-image packaging as an alternative
(per
aws-lambda-packaging-and-configuration),
but it's a deliberate choice for large/native dependencies, not the
default — for a typical function, package as zip/layer (Phase 2) and
deploy via UpdateFunctionCode/SAM rather than assuming every workload
needs a container image and registry push.
Symptom: A "canary" deploy shifts 10% of traffic as configured, but
five minutes later 100% of traffic is on the new version regardless of
whether it's actually healthy.
Fix: No alarm was attached to DeploymentPreference.Alarms (or the
alarm's metric/threshold doesn't actually reflect this function's error
rate) — CodeDeploy's Lambda traffic shift completes on a timer by
default; attach and verify a real, function-specific CloudWatch alarm
so a bad canary is caught and rolled back automatically.
Symptom: The SCA scan only checks requirements.txt/package.json
and reports "no vulnerabilities," but the actual deployed zip (after
pip install -t package/) contains a vulnerable transitive dependency
that never showed up in the scan.
Fix: Scan the unpacked, fully-resolved deployment package (Phase
3) after the install/bundle step, not just the top-level manifest —
this is the serverless-specific version of the "scan lockfiles, not
manifests" guidance in
software-composition-analysis-sca,
made more consequential because the entire dependency tree ships inside
one artifact with no separate layer boundary to scan independently.
Symptom: A downstream integration (an API Gateway stage, an
EventBridge rule) was pointed directly at $LATEST "temporarily," and a
routine deploy immediately breaks it in production with no canary
protection at all.
Fix: $LATEST has no alias/version indirection and therefore no
traffic-shifting or rollback path — repoint every downstream integration
at the prod alias (Phase 6) before the next deploy, treating a
$LATEST-pointed integration as a standing risk, not a temporary
convenience.
Scenario: payments-webhook, a Python Lambda function invoked via API
Gateway, gets its first full pipeline: PR-time SAST/SCA on the packaged
dependency tree, zip build, and a SAM deploy with a 10%/5-minute canary
gated on an error-rate alarm.
name: ci-cd
on:
pull_request: { branches: [main] }
push: { branches: [main] }
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
pip install -r requirements.txt -t package/
cp -r src/* package/
cd package && zip -r ../function.zip .
- uses: actions/upload-artifact@v4
with: { name: function-package, path: function.zip }
sca:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with: { name: function-package }
- run: |
unzip -q function.zip -d unpacked/
trivy fs --severity CRITICAL,HIGH --exit-code 1 unpacked/
deploy:
needs: sca
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: aws-actions/setup-sam@v2
- run: sam build
- run: sam deploy --stack-name payments-webhook --no-confirm-changeset --capabilities CAPABILITY_IAM
template.yaml's DeploymentPreference: Canary10Percent5Minutes (Phase
6) shifts 10% of API Gateway-routed invocations to the new version,
watches PaymentsWebhookErrorAlarm, and either completes the cutover to
100% after 5 clean minutes or automatically reverts the prod alias to
the prior version — no Kubernetes object, pod, or Service involved at any
point in the rollout.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub selvarajmurugesan90/ops-engineering-skills --plugin cicd-tooling-skills13 skills in this plugin
/aws-codepipeline-and-codedeployDesigns AWS CodePipeline stage/action structure and integrates it with CodeDeploy deployment groups and appspec.yml for EC2/on-prem, ECS, or Lambda deploys. Use when the user asks to "set up CodePipeline," "add a CodeDeploy deployment group," "write an appspec.yml," "wire CodePipeline to CodeDeploy," "troubleshoot a stuck/failed CodePipeline action," or "add a manual approval action before an AWS deploy."
/azure-pipelines-yaml-and-multi-stageDesigns Azure Pipelines YAML (azure-pipelines.yml), multi-stage pipelines with environments/approvals, templates for reuse across repos, and self-hosted vs. Microsoft-hosted agent pools. Use when the user asks to "set up Azure Pipelines," "write an azure-pipelines.yml," "add a multi-stage pipeline with approvals," "create a reusable pipeline template," "configure a self-hosted agent pool," or "troubleshoot a stuck/failed Azure DevOps pipeline run."
/bamboo-pipeline-yaml-and-java-specsAuthors Atlassian Bamboo pipeline definitions using either Bamboo Specs (Java DSL, compiled and run to create/update a plan) or Bamboo's YAML specs format, covering plan/job/stage structure and how a Specs definition links to and updates a live Bamboo plan. Use when the user asks to "write a Bamboo Specs plan," "convert our Bamboo plan to code," "add a stage/job to a Bamboo build," "use Bamboo YAML specs," or "troubleshoot a Bamboo Specs plan not updating the linked plan."
/complete-cicd-pipeline-deployment-for-kubernetes-from-scratchBuilds a complete CI/CD pipeline for a Kubernetes-targeted service from an empty repo — source checkout, container image build, SCA/SAST security gates, registry push, and a deploy step that ends at a GitOps handoff (committing a new image tag to a manifests repo) rather than a direct kubectl apply or helm upgrade against the cluster. Use when the user asks to "build a full CI/CD pipeline for Kubernetes from scratch," "set up CI/CD that ends in a GitOps commit, not a cluster deploy," "wire a container build pipeline into Argo CD/Flux," or "go from an empty repo to a Kubernetes service deployed via GitOps end-to-end."
/complete-cicd-pipeline-for-vm-based-workloads-from-scratchBuilds a complete CI/CD pipeline for a VM-based workload from an empty repo — source checkout, build, immutable machine-image baking (Packer-style AMI, not a container image or a zip), SCA/SAST security gates, and a deploy step that's either a blue-green instance-group swap or a config-management push (Ansible) to existing long-lived VMs, distinct from both container and serverless deploy mechanics. Use when the user asks to "build a full CI/CD pipeline for EC2/VM workloads from scratch," "bake an AMI in CI and roll it out blue-green," "push Ansible-managed config to existing VMs from a pipeline," or "go from an empty repo to a VM fleet deployed with a golden image and Auto Scaling Group swap."
/gitea-actions-and-ciConfigures Gitea Actions — Gitea's GitHub Actions-compatible CI/CD runner — including self-hosted act_runner setup/registration and the specific differences from GitHub Actions (supported contexts, missing features, runner labels). Use when the user asks to "set up CI on Gitea," "configure Gitea Actions," "register an act_runner," "port a GitHub Actions workflow to Gitea," or "troubleshoot a Gitea Actions job that isn't picked up by any runner."
Other plugins' skills for the same job