Skip to content

func-api-registration-keys-post

Overview

Deploys the Lambda function that handles POST /registration-keys. Generates one-time 6-character device registration keys stored in DynamoDB with a 30-minute TTL. The route is authenticated via the Cognito JWT authorizer (any authenticated user).

CloudFormation Stack

firefly-func-api-registration-keys-post

CloudWatch Logs

SettingValue
Log group/aws/lambda/firefly-func-api-registration-keys-post
Retention30 days

Dependencies

Deploy Dependencies

WorkflowReason
api-gatewayApiId and AuthorizerId resolved from stack outputs
dynamodb-registration-keysTable must exist before the function is deployed and granted write access
shared-layerLambda layer must exist before function deployment

Delete Dependencies

None — this workflow has no prerequisites.

Required By

Required By Deploy

WorkflowReason
run-integration-testsEndpoint must be live before integration tests run

Required By Delete

WorkflowReason
delete-api-gatewayRoute registration must be removed before the API Gateway stack is deleted
delete-dynamodb-registration-keysIAM permissions referencing the table must be removed first
delete-shared-layerLayer reference must be removed before the layer stack is deleted

IAM Permissions

The Lambda execution role (firefly-func-api-registration-keys-post-role) is granted:

  • dynamodb:PutItem on firefly-registration-keys
  • appconfig:StartConfigurationSession, appconfig:GetLatestConfiguration on *

Deploy Workflow

Description

Resolves the HTTP API Gateway ID, JWT Authorizer ID, shared layer ARN, and AppConfig extension layer ARN from CloudFormation stack outputs, then performs a SAM deploy.

Steps

  1. Configure AWS credentials.
  2. Look up ApiId from the firefly-api-gateway stack output.
  3. Look up AuthorizerId from the firefly-api-gateway stack output.
  4. Look up SharedLayerArn from the firefly-shared-layer stack output.
  5. Look up AppConfigExtensionLayerArn from the firefly-shared-layer stack output.
  6. SAM deploy firefly-func-api-registration-keys-post with parameters:
    • ApiId
    • AuthorizerId
    • SharedLayerArn
    • AppConfigExtensionLayerArn

Delete Workflow

Description

Calls sam delete to remove the Lambda function, its IAM role, and the API Gateway route integration. Also deletes the CloudWatch log group.

Steps

  1. Configure AWS credentials.
  2. SAM delete firefly-func-api-registration-keys-post.
  3. Delete CloudWatch log group /aws/lambda/firefly-func-api-registration-keys-post.

Failure Scenarios

ScenarioBehavior
firefly-api-gateway stack not founddescribe-stacks returns an error; workflow fails before SAM deploy. Deploy api-gateway first.
firefly-dynamodb-registration-keys stack not deployedFunction deploys but returns errors at runtime. Deploy dynamodb-registration-keys first.
firefly-shared-layer stack not foundLayer ARN lookup fails; SAM deploy is not attempted. Deploy shared-layer first.