一键导入
ipa-stack-queue
Deploy a queue tier stack: SQS + DLQ + worker Lambda + ESM + DynamoDB (feature-flagged).
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Deploy a queue tier stack: SQS + DLQ + worker Lambda + ESM + DynamoDB (feature-flagged).
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Deploy a backend tier stack: Lambda + API Gateway v2 + DynamoDB (feature-flagged).
Compose a deployment from stack skills and generate executable artifacts (Makefiles, security disposition). Use when the user says 'compose', 'generate deployment', or invokes /ipa-compose.
Initialize IPA project configuration
Deploy a CodePipeline CI/CD pipeline with CodeBuild for automated build/test/deploy.
Deploy a Terraform state backend (S3 + DynamoDB) via CloudFormation.
Deploy a CodeCommit repository for source code management.
| name | ipa-stack-queue |
| description | Deploy a queue tier stack: SQS + DLQ + worker Lambda + ESM + DynamoDB (feature-flagged). |
| model | opus |
Deploy a queue tier stack: SQS + DLQ + worker Lambda + ESM + DynamoDB (feature-flagged).
| Property | Value |
|---|---|
| Stack name | {APP_NAMESPACE}-{APP_ENV}-queue |
| Template | infra/cfn/queue/queue.yml |
| Capabilities | CAPABILITY_NAMED_IAM |
| Lifecycle | deploy (solution stack) |
| Tier | queue |
| Parameter | Required | Default | Description |
|---|---|---|---|
| Namespace | Yes | — | Project namespace prefix |
| Environment | Yes | — | Deployment environment (dev/staging/prod) |
| ImageUri | Yes | — | ECR image URI with tag |
| AuthIssuer | Yes | — | Cognito OIDC issuer URL |
| AuthAudience | Yes | — | Cognito app client ID |
| QueueName | No | jobs | Logical queue name |
| VisibilityTimeout | No | 300 | Message visibility timeout (seconds) |
| MessageRetentionPeriod | No | 345600 | Message retention (seconds, default 4 days) |
| MaxReceiveCount | No | 3 | Attempts before DLQ |
| CreateDLQ | No | true | Create dead-letter queue |
| FunctionName | No | fn-worker | Worker Lambda name |
| MemorySize | No | 512 | Worker Lambda memory (MB) |
| Timeout | No | 300 | Worker Lambda timeout (seconds) |
| ImageCommand | No | python,-m,sqs_handler | Worker container CMD |
| EnableJobsTable | No | false | Feature flag: create jobs DynamoDB table |
| Flag | Default | Condition | Controls |
|---|---|---|---|
| EnableJobsTable | false | HasJobsTable | JobsTable resource, DynamoDB IAM policy, JobsTableArn output |
| CreateDLQ | true | HasDLQ | DeadLetterQueue resource, DlqUrl/DlqArn outputs, DLQ depth alarm |
| Parameter | Source Stack | Source Output | Notes |
|---|---|---|---|
| ImageUri | ecr | RepositoryUri | Append :$(IMAGE_TAG) |
| AuthIssuer | cognito | IssuerUrl | OIDC issuer URL |
| AuthAudience | cognito | UserPoolClientId | App client ID |
| Output | Export Name | Description |
|---|---|---|
| QueueUrl | {StackName}-QueueUrl | Consumed by backend → SqsQueueUrl |
| QueueArn | {StackName}-QueueArn | Consumed by backend → SqsSendQueueArns |
| QueueName | {StackName}-QueueName | Physical queue name |
| WorkerFunctionArn | {StackName}-WorkerFunctionArn | Worker Lambda ARN |
| WorkerFunctionName | {StackName}-WorkerFunctionName | Worker Lambda name |
| DlqUrl | {StackName}-DlqUrl | Conditional (HasDLQ) |
| DlqArn | {StackName}-DlqArn | Conditional (HasDLQ) |
| JobsTableArn | {StackName}-JobsTableArn | Conditional (HasJobsTable) |
The queue worker Lambda reuses the shared rest-lambda container image built by the backend stack — CMD is overridden via the ImageCommand parameter. No additional build target is required for this stack; do not emit a duplicate build-rest-lambda when backend is also in the composition.
!GetAtt Table.ArnQueue deploys before backend (S2:B). Backend receives queue outputs via wirable parameters.
After deployment, the update-env-sqs target in scripts/env.mk writes SQS_QUEUE_URL to .env:
| Variable | Source Output | Description |
|---|---|---|
| SQS_QUEUE_URL | QueueUrl | SQS queue URL for job submission |
This enables the local FastAPI backend (load_dotenv()) to submit jobs to the deployed queue without manual .env configuration. The target runs as part of post-deploy.mk's update-env step, gated by .env existence (skipped in CI/CD).
Parameter overrides applied by /ipa-compose:
| Parameter | Value | Reason |
|---|---|---|
| FunctionName | fn-worker | Distinct from REST handler |
| InvokeMode | BUFFERED | Synchronous SQS processing |
| Timeout | 300 | Match REST handler timeout |
| ImageCommand | python,-m,sqs_handler | Worker entrypoint |
| EnableJobsTable | true | Job tracking feature |
aws cloudformation deploy \
--template-file infra/cfn/queue/queue.yml \
--stack-name $(APP_NAMESPACE)-$(APP_ENV)-queue \
--capabilities CAPABILITY_NAMED_IAM \
--parameter-overrides \
Namespace=$(APP_NAMESPACE) \
Environment=$(APP_ENV) \
ImageUri=$(REPO_URI):$(IMAGE_TAG) \
AuthIssuer=$(AUTH_ISSUER) \
AuthAudience=$(AUTH_AUDIENCE) \
EnableJobsTable=true
| Property | Value |
|---|---|
| Module path | infra/tf/queue/ |
| State key | {namespace}-{env}/queue/terraform.tfstate |
| Required version | >= 1.5.0 |
| Providers | hashicorp/aws >= 5.0 |
| Variable | Type | Default | Maps to CFN |
|---|---|---|---|
| namespace | string | — | Namespace |
| environment | string | — | Environment |
| region | string | — | (implicit) |
| state_bucket | string | — | (TF infrastructure) |
| image_uri | string | — | ImageUri |
| auth_issuer | string | — | AuthIssuer |
| auth_audience | string | — | AuthAudience |
| queue_name | string | jobs | QueueName |
| visibility_timeout | number | 300 | VisibilityTimeout |
| message_retention_period | number | 345600 | MessageRetentionPeriod |
| max_receive_count | number | 3 | MaxReceiveCount |
| function_name | string | fn-worker | FunctionName |
| memory_size | number | 512 | MemorySize |
| timeout | number | 300 | Timeout |
| image_command | string | python,-m,sqs_handler | ImageCommand |
| enable_jobs_table | bool | false | EnableJobsTable |
| Output | Maps to CFN |
|---|---|
| queue_url | QueueUrl |
| queue_arn | QueueArn |
| queue_name | QueueName |
| worker_function_arn | WorkerFunctionArn |
| worker_function_name | WorkerFunctionName |
| dlq_url | DlqUrl |
| dlq_arn | DlqArn |
| jobs_table_arn | JobsTableArn |
| Source Module | Data Source | Outputs Used |
|---|---|---|
| cognito | terraform_remote_state.cognito | issuer_url, user_pool_client_id |
| ecr | terraform_remote_state.ecr | repository_uri |