Introducing a new way to review your PRs.

Read the announcement

floci-io / floci

Light, fluffy, and always free - The AWS Local Emulator alternative

View on GitHub

38 documents · Updated Nov 23, 2026

docs / svc-dlm

Data Lifecycle Manager

Data Lifecycle Manager (DLM) manages AWS-compatible lifecycle policies for automated EBS snapshot work. It accepts policy definitions, keeps their state and schedule rules by account and Region, and exposes the policy lifecycle through the DLM API. The service stores policy intent; the code covered here does not run the snapshot jobs themselves.

System boundary

The DLM service is the policy control plane for snapshot lifecycle rules. A policy names the resources to manage and the rules that guide snapshot creation, retention, tagging, copy, and deletion behavior. These rules can target EBS volumes or instances, which connects policy selection to the resources described by the EC2 networking service only through shared AWS resource concepts.

Lifecycle policy state

Each lifecycle policy has an identity, an account and Region scope, a state, and a set of policy details. The state is ENABLED or DISABLED when a policy is created or changed. The list operation also accepts ERROR as a filter value so clients can query the full AWS-style state set even though this service does not create an error state through these operations.

The policy identity remains stable across updates. The service returns a policy ID and an account- and Region-specific policy ARN, while creation and modification times show the policy's history. An update changes only fields present in the request and refreshes the modification time when a change occurs.

References: src/…/LifecyclePolicy.java• L10-26 src/…/DlmService.java• L55-89 src/…/DlmService.java• L134-194

Policy ownership and scope

Policies are isolated by account and Region. A lookup uses the policy ID within the current Region, while ARN-based tag operations find the policy within that same Region and account context. This keeps two accounts or Regions from sharing lifecycle-policy state.

References: src/…/DlmService.java• L43-53 src/…/DlmService.java• L91-95 src/…/DlmService.java• L265-271

Request interface

The DLM API presents policy management as a small resource interface. The controller resolves the request Region, passes the JSON policy document to the service, and shapes the result into AWS-style response fields.

Policy management operations

The public API uses the following operations:

OperationPurposeResult
POST /policiesCreate a lifecycle policyReturns PolicyId
GET /policies/{policyId}Read one policyReturns Policy
GET /policiesList policies with filtersReturns Policies summaries
PATCH /policies/{policyId}Change selected policy fieldsReturns an empty success object
DELETE /policies/{policyId}Remove a policyReturns an empty success object

The single-policy response includes the policy details, tags, ARN, dates, state, and default-policy flag. List results are smaller and include the policy type and filters that help clients find policies without reading each full document. Policy IDs, descriptions, execution role ARNs, and states are checked before the service changes state.

References: src/…/DlmController.java• L45-100 src/…/DlmController.java• L102-135 src/…/DlmService.java• L430-481

Request routing

DLM shares the public /policies path with another service. The DLM route filter uses the SigV4 service name in the Authorization header to decide whether a request belongs to DLM. When it does, the filter moves the request to an internal /_dlm path before route matching. Requests for other services keep their original path.

The routing decision is therefore part of the API contract: a correctly formed path with the wrong service scope is not a DLM request. See request routing and protocols for the wider request model.

This diagram shows how the service scope selects the DLM controller without changing the public API path seen by clients.

flowchart LR
    A[Client request to /policies] --> B[Read SigV4 service scope]
    B --> C{Scope is dlm?}
    C -- No --> D[Continue normal routing]
    C -- Yes --> E[Rewrite to /_dlm/policies]
    E --> F[DLM controller]
    F --> G[Region-scoped policy state]

References: src/…/DlmRouteFilter.java• L12-23 src/…/DlmRouteFilter.java• L32-53 src/…/DlmController.java• L29-43

Policy configuration

Policy configuration combines the policy's control fields with a flexible PolicyDetails document. The control fields cover state, default policy type, schedule and retention values, while the details document carries resource selectors and schedule-specific rules.

Schedule and retention rules

Creation and retention intervals are positive integer values. For default policies, the service places these values into PolicyDetails with the resource type and a simplified policy language. This gives clients one policy document that describes both the resource class and the lifecycle rules.

Schedule entries can include tags to add to created snapshots. A policy can also carry target tags that select source resources. Copy settings, cross-Region copy targets, and deletion extensions add downstream handling rules, while exclusions remove selected resources from the policy's scope.

The service validates the shape of these values but does not execute the schedule. It preserves the rules for later consumers that perform snapshot work.

References: src/…/DlmService.java• L75-84 src/…/DlmService.java• L273-321 src/…/LifecyclePolicy.java• L20-26

Resource and policy types

The policy contract supports EBS volume and instance resource types. Policy details may identify an EBS snapshot management policy, an image management policy, or an event-based policy. Default policies use VOLUME or INSTANCE, and list filters can select one default type or all default policies.

Resource and tag filters use intersection for resource types and containment for tag pairs. A policy matches a resource-type filter when the two sets share a value. It matches target-tag or schedule-tag filters only when it contains every requested Key=Value pair.

References: src/…/DlmService.java• L36-42 src/…/DlmService.java• L97-131 src/…/DlmService.java• L499-547

Policy tags

Tags are part of a policy's visible state and can be changed without changing its lifecycle rules. The service accepts string key-value maps, rejects reserved aws: keys, limits the number and size of tags, and supports adding or removing tags through ARN-based resource tagging operations.

References: src/…/DlmService.java• L202-258 src/…/DlmService.java• L338-377

Policy change flow

Policy changes follow a validate, copy, update, and store sequence. The service reads the current policy before an update, applies only supplied fields to a copy, and stores the result only when at least one field changed.

Policy type and resource type fields inside PolicyDetails are stable after creation when both the old and new values are present. This protects the meaning of an existing policy while still allowing changes to state, descriptions, intervals, copy behavior, exclusions, and other mutable settings.

References: src/…/DlmService.java• L134-194 src/…/DlmService.java• L293-304

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the public /policies path, the DLM SigV4 service scope, and the internal /_dlm controller path aligned. A mismatch can send a valid client request to the wrong service.
  • Keep PolicyId, PolicyArn, and the account-Region storage key consistent. These values are used by different read, delete, and tag paths.
  • Keep PolicyDetails fields aligned with list filters. Resource types, target tags, and schedule tags must remain readable by the matching logic.
  • Keep default-policy fields and their normalized PolicyDetails representation synchronized. Changes to intervals or copy rules must still appear in the policy document returned to clients.
  • Preserve the difference between update-time state values and list filter state values. ERROR is queryable but is not a valid create or update state.

Important failure modes

TriggerConsequenceGuard
DLM policy path lacks a SigV4 dlm service scopeThe request is not rewritten to the DLM controllerSign the request for the DLM service scope
Missing or malformed execution role, description, state, or policy objectThe operation returns InvalidRequestException with no policy changeSend the required fields with the allowed value shapes
Unknown or malformed policy IDThe operation fails with an invalid-request or not-found errorUse the returned policy- ID for later operations
Change to existing PolicyType or resource type in PolicyDetailsThe update is rejected because the policy meaning would changeCreate a new policy when the policy class or resource class must change
More than one resourceTypes filter valueThe list request is rejectedSend zero or one resource type filter
Invalid tag key, non-string tag value, or too many tagsCreate or tag operations are rejectedUse valid non-aws: keys and bounded string maps

Key files

FileWhy to read it
src/…/DlmController.javaShows the AWS-compatible policy endpoints and response shapes.
src/…/DlmRouteFilter.javaShows how the shared /policies path is assigned to DLM requests.
src/…/DlmService.javaDefines policy state, validation, filtering, updates, tags, and account-Region scope.
src/…/LifecyclePolicy.javaDefines the policy state that flows between the API and storage layer.