# hkb-net-image-lifecycle

Image Builder lifecycle policy for the NAT AMI. Deletes images beyond the newest two.

- **Lives in:** [Sandbox](/architecture/sandbox/), [Dev](/architecture/dev/), [Prod](/architecture/prod/). **Trusted by:** `imagebuilder.amazonaws.com`.
- **Boundary:** `hkb-workload-boundary`.
- **Reach:** AWS managed policies only (`EC2ImageBuilderLifecycleExecutionPolicy`).
- **Source:** `network/hkb-image.yaml`, resource `LifecycleRole`.

## Trust policy

```yaml
AssumeRolePolicyDocument:
  Version: "2012-10-17"
  Statement:
    - Effect: Allow
      Principal:
        Service: imagebuilder.amazonaws.com
      Action: sts:AssumeRole
      Condition:
        StringEquals:
          aws:SourceAccount: !Ref AWS::AccountId
```

## Permissions

```yaml
ManagedPolicyArns:
  - !Sub arn:${AWS::Partition}:iam::aws:policy/service-role/EC2ImageBuilderLifecycleExecutionPolicy
```
