aws-lambda-to-cloud-run-migration
Skill1 starsChanged 4 months agoApache-2.0View on GitHub
Migrates AWS Lambda functions to Google Cloud Run. Analyzes AWS lock-ins (SNS, SQS, SDKs, IAM, Cold Starts), build/trigger mechanisms (API Gateway vs direct), and service integrations to provide a detailed migration report, containerization tips, and GCP service mapping.
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- apigee-x-proxy-developmentSkill
- aws-lambda-fleet-to-cloud-runSkill
- preso-builderSkill
- visual-docsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 7 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Before starting or when you need specific details, load the following resources into context:
- Very specific: line 26
references/migration_guide.md: Read this for the end-to-end migration strategy and detailed step-by-step methodology. - Very specific: line 27
references/advanced_mapping.md: Read this when you encounter complex AWS services (beyond basic SNS/SQS) that need to be mapped to GCP … - Very specific: line 28
references/containerization.md: Read this for boilerplate Dockerfiles and Cloud Run constraints (e.g., port handling) across Node.js, … - Very specific: line 29
references/iac_translation.md: Read this for migrating AWS SAM, Serverless Framework, AWS CDK, or raw AWS Terraform (.tf) files to GCP. - Very specific: line 30
references/export_guide.md: Read this for strategies on exporting current AWS configurations (like CloudFormation or SAM templates) for … - Distinctive: line 34
If the user's environment has the following MCP servers installed, you MUST use them to gather up-to-date information during the migration:
- Distinctive: line 64
When provided with Lambda code or configuration (e.g., SAM, CloudFormation, Serverless Framework, AWS CDK, or AWS Terraform), follow these …
- Very specific: line 67
Identify SDK Usage: Look for boto3 (Python), aws-sdk (Node.js/Go/Java), or aws/aws-sdk-php (PHP).
- Very specific: line 76
If the Lambda is triggered by API Gateway, Webhooks, or real-time events (Pub/Sub) → Cloud Run Service.
- Distinctive: line 77
If the Lambda is a cron job (EventBridge scheduled), a data processing script, or an asynchronous batch task → Cloud Run Job.
- Distinctive: line 83
Database Access: Check for DynamoDB (map to Firestore/Spanner) or RDS (map to Cloud SQL).
- Distinctive: line 103
All migrated code must be containerized.
- Very specific: line 105
Entry point: Ensure the application listens on 0.0.0.0:$PORT.
- Distinctive: line 109
If information is missing, use these prompts to guide the user:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AWS Lambda to Google Cloud Run Migration Skill
This skill assists in the assessment, analysis, and migration of AWS Lambda functions to Google Cloud Run, following the official Google Cloud migration framework.
When to Use This Skill
Positive Triggers
- Migrating a single AWS Lambda function to Google Cloud Run.
- Per-function AST analysis (
analyze_lambda.py) for AWS SDK lock-ins (SNS, SQS, DynamoDB, S3). - Containerization (Dockerfile generation) and runtime conversion (Flask, Express, FastAPI, Go
net/http, FrankenPHP). - Infrastructure as Code (IaC) translation (AWS SAM, Serverless Framework, CDK, or AWS
.tfto GCP Terraform orgcloudscripts).
Negative Triggers (When NOT to Use)
- Fleet discovery, multi-function monorepos (2+ Lambdas), domain consolidation strategy, or migration wave sequencing across multiple functions -> Delegate to
aws-lambda-fleet-to-cloud-run.
Available Resources
Before starting or when you need specific details, load the following resources into context:
scripts/analyze_lambda.py: ALWAYS run this script first on the target directory (e.g.,python scripts/analyze_lambda.py <target_dir>). Use the optional--output <dir>flag to control wheremigration_manifest.jsonis written (defaults to the current working directory, not the source tree). Use--summaryfor a human-readable terminal overview. It uses AST parsing, IaC traversal,composer.json,package.json, andrequirements.txtscanning to automatically discover AWS SDK lock-ins, connection pools, and triggers, generating amigration_manifest.jsonfile. You MUST read this JSON file immediately after running the script to understand the application's AWS footprint.references/migration_guide.md: Read this for the end-to-end migration strategy and detailed step-by-step methodology.references/advanced_mapping.md: Read this when you encounter complex AWS services (beyond basic SNS/SQS) that need to be mapped to GCP equivalents.references/containerization.md: Read this for boilerplate Dockerfiles and Cloud Run constraints (e.g., port handling) across Node.js, Python, PHP, Java, and Go.references/iac_translation.md: Read this for migrating AWS SAM, Serverless Framework, AWS CDK, or raw AWS Terraform (.tf) files to GCP. Covers two output paths: Path A (Terraformgoogleprovider) for production-grade IaC, and Path B (Cloud Build +gcloud run deploy) for scripted/CI-CD migrations.references/export_guide.md: Read this for strategies on exporting current AWS configurations (like CloudFormation or SAM templates) for analysis.
Recommended External Tools
If the user's environment has the following MCP servers installed, you MUST use them to gather up-to-date information during the migration:
- AWS Documentation Tools (
mcp_aws-docs_*): Usesearch_documentationandread_documentationto look up precise behaviors of AWS Lambda features, API Gateway event payloads, or AWS SDK constraints. - Google Developer Knowledge Tools (
mcp_developer-knowledge_*): Usesearch_documentsandget_documentsto find the latest official guides, API references, and best practices for Cloud Run, Eventarc, Pub/Sub, and GCP IAM.
1. Migration Framework
Phase 1: Assess & Discover
- Inventory: Catalog all Lambda functions, triggers, and dependencies.
- Complexity Assessment:
- Low Complexity: Stateless, simple HTTP trigger, minimal AWS SDK usage.
- Medium Complexity: Uses S3/SNS/SQS, VPC access, or Lambda Layers.
- High Complexity: Part of a Step Function, custom Runtimes, or heavy AWS-specific orchestration.
Phase 2: Plan & Foundation
- Resource Hierarchy: Define GCP Projects and Folders.
- IAM Strategy: Map AWS IAM Roles to GCP Service Accounts.
- Networking: Plan VPC Connectors or Direct VPC Egress for internal access.
Phase 3: Migrate & Refactor
- Containerization: Convert code to OCI-compliant images. → ACTION: Load
references/containerization.mdto select the right Buildpack or Dockerfile strategy for your target language (including FrankenPHP/RoadRunner for PHP). - Service Mapping: Replace AWS services with GCP equivalents. → ACTION: If dealing with API Gateway, SNS, SQS, or direct invokes, load
references/advanced_mapping.mdfor proper translation architectures. - Infrastructure as Code (IaC): Convert AWS deployment templates to Terraform or a scripted
gcloud+ Cloud Build pipeline. → ACTION: Loadreferences/iac_translation.mdif the user providestemplate.yaml,serverless.yml, CDK code, or AWS Terraform (.tf) files. The guide offers two GCP deployment paths: Path A (Terraform) for production repeatability, and Path B (Scripted — Cloud Build +gcloud run deploy) for fast migrations. Ask the user which they prefer before generating output. - Data Migration: Plan migration for RDS/DynamoDB if necessary.
Phase 4: Optimize
- Scaling: Configure Min/Max instances and Concurrency.
- Performance: Enable Startup CPU Boost for cold start mitigation.
2. Analysis Workflow
When provided with Lambda code or configuration (e.g., SAM, CloudFormation, Serverless Framework, AWS CDK, or AWS Terraform), follow these steps:
#1 - Lock-in Analysis
- Identify SDK Usage: Look for
boto3(Python),aws-sdk(Node.js/Go/Java), oraws/aws-sdk-php(PHP). Highlight specific service calls. Checkcomposer_analysisin the output manifest for Laravel, Symfony, or Slim markers. - Messaging Services: Identify dependencies on SNS (Simple Notification Service) or SQS (Simple Queue Service).
- Raw API Calls vs. SDKs: Identify usage of
requests,axios,guzzle, orcurlto call AWS services directly. Highlight hardcoded Client IDs, Client Secrets, or API Keys. - Auth Strategy: Note if the code manually signs requests (SigV4) or uses basic auth. In GCP, we prioritize using GCP Client Libraries which handle authentication transparently via the attached Service Account. → ACTION: Load
references/migration_guide.mdif you find hardcoded secrets or raw HTTP calls that need refactoring to Workload Identity. - Triggers: Determine if it's an HTTP-based trigger (API Gateway, ALB) or event-driven (S3, DynamoDB Streams). For PHP, check if Bref (
php-82-fpmorphp-82) is used inserverless.yml. - Cold Start Considerations: Note memory settings and runtime version, as these impact cold start profiles.
#2 - Build and Trigger Analysis
- Execution Paradigm (CRITICAL): You must determine if this code should be a Service or a Job.
- If the Lambda is triggered by API Gateway, Webhooks, or real-time events (Pub/Sub) → Cloud Run Service. It must listen on
$PORT. - If the Lambda is a cron job (EventBridge scheduled), a data processing script, or an asynchronous batch task → Cloud Run Job. It does not need a web server; it should just execute as a script and exit.
- If the Lambda is triggered by API Gateway, Webhooks, or real-time events (Pub/Sub) → Cloud Run Service. It must listen on
- Port Handling (For Services): AWS Lambda doesn't listen on a port. A Cloud Run Service MUST listen on the port defined by the
PORTenvironment variable (default 8080).
#3 - Integration & Auth Analysis
- IAM Strategy: Map AWS IAM Execution Roles to GCP IAM Service Accounts.
- Networking: Identify if the Lambda is in a VPC (for RDS, internal ELBs) and recommend Serverless VPC Access or Direct VPC egress on GCP.
- Database Access: Check for DynamoDB (map to Firestore/Spanner) or RDS (map to Cloud SQL).
3. Migration Paths
Service Mapping Table
| AWS Service | Google Cloud Equivalent | Migration Strategy |
| API Gateway / ALB | Cloud Run built-in URL / GCLB | Use built-in HTTPS URL; add Global LB for WAF or multi-region. |
| SNS | Pub/Sub (Topics) | Push subscriptions trigger Cloud Run URLs directly. |
| SQS | Cloud Tasks / Pub/Sub | Use Cloud Tasks for rate-limiting/queuing; Pub/Sub for async events. |
| EventBridge / Cron | Eventarc / Cloud Scheduler | Use Cloud Scheduler for cron; Eventarc for cross-service events. |
| IAM Role | IAM Service Account | Attach the service account to the Cloud Run service. |
| DynamoDB | Firestore / Spanner / Cloud SQL | Firestore for document-model; Spanner for relational scale; Cloud SQL for RDS migrations. |
| S3 | Cloud Storage | Direct equivalent; use FUSE mount for file-system access patterns. |
| Lambda Layers | Multi-stage Docker builds | Shared libraries become Docker COPY --from base image layers. |
| Step Functions | Cloud Workflows | Convert ASL (Amazon States Language) to YAML Workflows; orchestrates HTTP calls to Cloud Run. |
| Secrets Manager / SSM | Secret Manager | Mount as volume (preferred) or env var in Cloud Run. |
| SES (Email) | SendGrid / Mailchimp (3rd party) | No native GCP email service; use a transactional email provider via Cloud Run env vars. |
Containerization
All migrated code must be containerized. Cloud Run requires an OCI-compliant image.
- Language Frameworks: Convert raw Lambda handlers into web servers (e.g., Flask, Express, FastAPI, Go
net/http). - Entry point: Ensure the application listens on
0.0.0.0:$PORT.
4. Interactive Guidance
If information is missing, use these prompts to guide the user:
- "Could you provide the
template.yaml(SAM),serverless.yml, CDK stack, or Terraform.tffiles to analyze the triggers and IAM roles?" (→ ACTION: If the user doesn't know how to get these, loadreferences/export_guide.mdto help them export their AWS config). - "Does this Lambda require access to internal VPC resources like RDS or a private API?"
- "Is the traffic pattern predictable (allowing for Min Instances) or highly bursty (requiring Cold Start optimization)?"
- "For the GCP deployment: would you prefer Path A — Terraform (production-grade IaC, repeatable, state-managed) or Path B — Scripted (
gcloud run deploy+ Cloud Build, faster to get started)? → ACTION: Loadreferences/iac_translation.mdand present both options with trade-offs before generating any output templates."
5. Final Deliverable Structure
Your final report should include:
- Status Quo Analysis: Detailed breakdown of current AWS dependencies.
- Lock-in Highlights: Code snippets from the source that are "AWS-specific" and need refactoring.
- Target Architecture: A proposed GCP diagram/description.
- Migration Steps: Sequential steps for containerization, IAM setup, and service mapping.
- Code Snippets: "Before" (AWS SDK) vs "After" (GCP Client Library) examples.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

