arch-cloud
Cloud: serverless Lambda/CF Workers, edge, CDN, multi-region, HA patterns, IaC Terraform
What this skill does
# arch-cloud
## Purpose
This skill helps design and implement cloud architectures focused on serverless technologies (e.g., AWS Lambda, Cloudflare Workers), edge computing, CDNs, multi-region setups for high availability (HA), and Infrastructure as Code (IaC) using Terraform. It ensures scalable, cost-effective solutions by guiding precise configuration and deployment.
## When to Use
Use this skill for applications needing low-latency edge delivery, serverless backends to reduce costs, multi-region redundancy for HA, or IaC automation. Examples include building global APIs, migrating to serverless, or optimizing CDN for media delivery. Avoid for simple monolithic apps or on-prem setups.
## Key Capabilities
- Deploy serverless functions: Create AWS Lambda or Cloudflare Workers for event-driven processing.
- Edge and CDN integration: Configure Cloudflare for edge caching and routing to reduce latency.
- Multi-region HA patterns: Set up auto-failover with AWS Route 53 or Cloudflare load balancers.
- IaC with Terraform: Define and provision cloud resources declaratively for reproducibility.
- Cost optimization: Analyze patterns like using Lambda's reserved concurrency or Terraform's cost modules.
## Usage Patterns
1. **Serverless API Deployment**: Use Terraform to define a Lambda function and API Gateway, then deploy for quick scaling. Ensure multi-region setup by adding Route 53 for failover.
2. **Edge-Computing CDN Setup**: Integrate Cloudflare Workers with a CDN to cache assets and handle requests at the edge, reducing origin server load. Combine with Terraform for automated provisioning across regions.
## Common Commands/API
- **Terraform Commands**: Initialize with `terraform init`; plan changes with `terraform plan -out=plan.tfplan`; apply with `terraform apply plan.tfplan`. Use `-var="region=us-east-1"` for region-specific vars.
- **AWS CLI for Lambda**: Create a function using `aws lambda create-function --function-name myLambda --zip-file fileb://function.zip --handler index.handler --runtime nodejs14.x --role arn:aws:iam::123456789012:role/lambdaRole`. Invoke with `aws lambda invoke --function-name myLambda out.txt`.
- **Cloudflare API Endpoints**: Authenticate with `$CLOUDFLARE_API_KEY` env var. Create a Worker script via POST to `https://api.cloudflare.com/client/v4/accounts/{account_id}/workers/scripts` with JSON body: `{"id": "myWorker", "content": "addEventListener('fetch', event => event.respondWith(new Response('Hello')));"}`.
- **Config Formats**: Use HCL in Terraform files, e.g., `resource "aws_lambda_function" "example" { function_name = "myFunction" runtime = "nodejs14.x" handler = "index.handler" filename = "function.zip" }`. For API keys, set in env vars like `export AWS_ACCESS_KEY_ID=$AWS_API_KEY`.
## Integration Notes
Integrate Terraform with CI/CD by running `terraform plan` in GitHub Actions via a workflow step: `run: terraform plan -out=plan.out`. For serverless, link Lambda to S3 triggers using Terraform: `resource "aws_lambda_permission" "allow_s3" { action = "lambda:InvokeFunction" function_name = aws_lambda_function.example.function_name principal = "s3.amazonaws.com" source_arn = aws_s3_bucket.example.arn }`. Use `$TERRAFORM_STATE_BUCKET` for remote state storage. For edge services, route traffic from Cloudflare to AWS via API Gateway by configuring Cloudflare's origin settings with the Gateway endpoint.
## Error Handling
Handle Terraform errors by checking `terraform plan` output for diffs and running `terraform apply --auto-approve` only after review; common issues include dependency cycles—fix by ordering resources in .tf files. For Lambda, catch invocation errors with `aws lambda invoke --function-name myLambda out.txt` and parse logs via CloudWatch: use `aws logs get-log-events --log-group /aws/lambda/myLambda --log-stream latest`. If Cloudflare API returns 401, verify `$CLOUDFLARE_API_KEY` and retry with exponential backoff. In code, wrap API calls in try-catch: `try { const response = await fetch('https://api.cloudflare.com/...'); } catch (error) { console.error(error.message); }`. Always validate region configs to avoid "region not supported" errors.
## Concrete Usage Examples
1. **Deploy a Multi-Region Serverless Function**: First, set env vars: `export AWS_REGION=us-east-1` and `export AWS_ACCESS_KEY_ID=$AWS_API_KEY`. Create a Terraform file: `resource "aws_lambda_function" "globalFn" { ... } resource "aws_route53_record" "failover" { zone_id = "Z1234567890" name = "api.example.com" type = "A" failover_routing_policy { ... } }`. Run `terraform init && terraform apply` to deploy Lambda in us-east-1 and set up Route 53 for HA.
2. **Set Up Edge CDN with Workers**: Authenticate Cloudflare with `export CLOUDFLARE_API_KEY=your_key`. Use Terraform to provision: `resource "cloudflare_worker_script" "edgeScript" { name = "edgeWorker" content = "addEventListener('fetch', event => { ... }); } resource "cloudflare_zone" "example" { zone = "example.com" }`. Deploy with `terraform apply`, then test by curling the Worker endpoint.
## Graph Relationships
- Related to: se-architecture cluster (e.g., 'design-patterns' for architectural blueprints, 'deployment-strategies' for rollout techniques).
- Connected via tags: 'cloud' links to 'aws-services' skill; 'serverless' to 'lambda-optimizations'; 'terraform' to 'iac-best-practices'.
Related in Cloud & DevOps
appbuilder-action-scaffolder
IncludedCreate, implement, deploy, and debug Adobe Runtime actions with consistent layout, validation, and error handling. Use this skill whenever the user needs to add actions to an App Builder project, understand action structure (params, response format, web/raw actions), configure actions in the manifest, use App Builder SDKs (State, Files, Events, database), deploy and invoke actions via CLI, debug action issues, or implement patterns such as webhook receivers, custom event providers, journaling consumers, large payload redirects, action sequence pipelines, and Asset Compute workers. Also trigger when users mention serverless functions in Adobe context, action logging, IMS authentication for actions, or cron-style scheduled actions.
orchestrating-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. Use this skill when the user needs a multi-step Data Cloud pipeline, cross-phase troubleshooting, or data space and data kit management. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase sf data360 workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching phase-specific skill), the task is STDM/session tracing/parquet telemetry (use observing-agentforce), standard CRM SOQL (use querying-soql), or Apex implementation (use generating-apex).
github-project-automation
IncludedAutomate GitHub repository setup with CI/CD workflows, issue templates, Dependabot, and CodeQL security scanning. Includes 12 production-tested workflows and prevents 18 errors: YAML syntax, action pinning, and configuration. Use when: setting up GitHub Actions CI/CD, creating issue/PR templates, enabling Dependabot or CodeQL scanning, deploying to Cloudflare Workers, implementing matrix testing, or troubleshooting YAML indentation, action version pinning, secrets syntax, runner versions, or CodeQL configuration. Keywords: github actions, github workflow, ci/cd, issue templates, pull request templates, dependabot, codeql, security scanning, yaml syntax, github automation, repository setup, workflow templates, github actions matrix, secrets management, branch protection, codeowners, github projects, continuous integration, continuous deployment, workflow syntax error, action version pinning, runner version, github context, yaml indentation error
sf-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase `sf data360` workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching sf-datacloud-* skill), the task is STDM/session tracing/parquet telemetry (use sf-ai-agentforce-observability), standard CRM SOQL (use sf-soql), or Apex implementation (use sf-apex).
fabric-cli
IncludedUse this skill for Fabric.so CLI workflows with the `fabric` terminal command: diagnose/install/login, search or browse a Fabric library, save notes/links/files, create folders, ask the Fabric AI assistant, manage tasks/workspaces, generate shell completion, check subscription usage, produce JSON output, and use Fabric as persistent agent memory. Do not use for Microsoft Fabric/Azure/Power BI `fab`, Daniel Miessler's Fabric framework, Python Fabric SSH, Fabric.js, or textile/fashion fabric.
lark
IncludedLark/Feishu CLI skills: lark-cli operations for docs, markdown, sheets, base, calendar, im, mail, task, okr, drive, wiki, slides, whiteboard, apps, approval, attendance, contact, vc, minutes, event. Use when the user needs to operate Lark/Feishu resources via lark-cli, send messages, manage documents, spreadsheets, calendars, tasks, OKRs, deploy web pages, or any Feishu/Lark workspace operations.