I Tried Enforcing the Use of Approved AMIs with AMI Watermarks, a New Feature of Amazon EC2

I Tried Enforcing the Use of Approved AMIs with AMI Watermarks, a New Feature of Amazon EC2

Amazon EC2 adds AMI Watermarks. Apply watermarks to private AMIs and combine them with Allowed AMIs to permit launches only from AMIs with approved watermarks. Tested via CLI, from basic operations to propagation and launch control.
2026.06.25

This page has been translated by machine translation. View original

Introduction

On June 24, 2026, the AMI Watermarks feature was added to Amazon EC2.

Previously, tracking the provenance of an AMI relied on naming conventions and tags, and after copying or deriving, it was hard to tell the relationship to the original AMI. AMI Watermarks solves this problem. It embeds a structured identifier in a private AMI and automatically carries it over when the AMI is copied or derived.

https://aws.amazon.com/jp/about-aws/whats-new/2026/06/ec2-image-watermarks-allowed-images/

Here are the key points of the feature.

Item Details
WatermarkKey format AccountID:WatermarkName (the account ID is added automatically)
Propagation Automatically carried over by CopyImage and CreateImage
Limit Up to 5 per AMI
Target Private AMIs only (cannot be attached to public AMIs)
Price No additional charge
Regions All Regions (including China and GovCloud)

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-watermark.html

Basic watermark operations

The test environment is as follows.

  • Region: ap-northeast-1
  • CLI: aws-cli/2.35.11

Attaching

Since watermarks can only be attached to private AMIs, first copy a public AMI to create a private AMI.

aws ec2 copy-image \
  --source-image-id ami-0bc1ef7af11bba977 \
  --source-region ap-northeast-1 \
  --region ap-northeast-1 \
  --name "watermark-test"
{
    "ImageId": "ami-0496605161386a315"
}

After the AMI becomes available, attach a watermark.

aws ec2 attach-image-watermark \
  --image-id ami-0496605161386a315 \
  --watermark-name "my-approved-ami" \
  --region ap-northeast-1
{
    "WatermarkKey": "123456789012:my-approved-ami"
}

The WatermarkKey is generated in a format with the account ID automatically prepended.

Checking

You can check it in the ImageWatermarks field of describe-images.

aws ec2 describe-images --image-ids ami-0496605161386a315 --region ap-northeast-1
"ImageWatermarks": [
    {
        "WatermarkKey": "123456789012:my-approved-ami",
        "SourceImageRegion": "ap-northeast-1",
        "SourceImageId": "ami-0496605161386a315",
        "SourceImageCreationTime": "2026-06-24T23:22:04.976000+00:00",
        "WatermarkCreationTime": "2026-06-24T23:23:15.914000+00:00"
    }
]

Removing

You can remove a watermark with detach-image-watermark. Since the AMI above is used in later tests, I verified this with a separate test AMI.

aws ec2 detach-image-watermark \
  --image-id ami-094676932a70ae1b1 \
  --watermark-key "123456789012:my-approved-ami" \
  --region ap-northeast-1
{
    "Return": true
}

After removal, the ImageWatermarks field in describe-images became empty. Note that, according to the documentation, watermarks that have already propagated to derived AMIs are not affected even if they are removed from the original AMI.

Filtering

You can search across AMIs that have a specific watermark with the image-watermark-key filter.

aws ec2 describe-images \
  --filters "Name=image-watermark-key,Values=123456789012:my-approved-ami" \
  --region ap-northeast-1

Verifying propagation to derived AMIs

I launched an instance from a watermarked AMI and created a new AMI from that instance with create-image.

# Launch instance
aws ec2 run-instances \
  --image-id ami-094676932a70ae1b1 \
  --instance-type t4g.nano \
  --subnet-id subnet-0123456789abcdef0 \
  --no-associate-public-ip-address \
  --region ap-northeast-1

# Create AMI
aws ec2 create-image \
  --instance-id i-0abc1234def567890 \
  --name "watermark-derived-test" \
  --no-reboot \
  --region ap-northeast-1

When I checked the watermarks of the derived AMI (ami-03df64fb303906bfb), all 5 watermarks attached to the original AMI had been carried over. The SourceImageId of each watermark points to the original AMI (ami-094676932a70ae1b1), and the timestamps are preserved as in the original. I confirmed that watermarks reliably propagate when deriving via CreateImage.

Output of all 5 entries (click to expand)
[
  {
    "WatermarkKey": "123456789012:test-wm-1",
    "SourceImageRegion": "ap-northeast-1",
    "SourceImageId": "ami-094676932a70ae1b1",
    "SourceImageCreationTime": "2026-06-24T23:30:43.576000+00:00",
    "WatermarkCreationTime": "2026-06-24T23:33:26.234000+00:00"
  },
  {
    "WatermarkKey": "123456789012:test-wm-2",
    "SourceImageRegion": "ap-northeast-1",
    "SourceImageId": "ami-094676932a70ae1b1",
    "SourceImageCreationTime": "2026-06-24T23:30:43.576000+00:00",
    "WatermarkCreationTime": "2026-06-24T23:33:26.875000+00:00"
  },
  {
    "WatermarkKey": "123456789012:test-wm-3",
    "SourceImageRegion": "ap-northeast-1",
    "SourceImageId": "ami-094676932a70ae1b1",
    "SourceImageCreationTime": "2026-06-24T23:30:43.576000+00:00",
    "WatermarkCreationTime": "2026-06-24T23:33:27.649000+00:00"
  },
  {
    "WatermarkKey": "123456789012:test-wm-4",
    "SourceImageRegion": "ap-northeast-1",
    "SourceImageId": "ami-094676932a70ae1b1",
    "SourceImageCreationTime": "2026-06-24T23:30:43.576000+00:00",
    "WatermarkCreationTime": "2026-06-24T23:33:28.434000+00:00"
  },
  {
    "WatermarkKey": "123456789012:test-wm-5",
    "SourceImageRegion": "ap-northeast-1",
    "SourceImageId": "ami-094676932a70ae1b1",
    "SourceImageCreationTime": "2026-06-24T23:30:43.576000+00:00",
    "WatermarkCreationTime": "2026-06-24T23:33:29.139000+00:00"
  }
]

Limit test

I attached watermarks to a single AMI consecutively to check the limit.

for i in 1 2 3 4 5 6; do
  echo "--- Attach watermark-$i ---"
  aws ec2 attach-image-watermark \
    --image-id ami-094676932a70ae1b1 \
    --watermark-name "test-wm-$i" \
    --region ap-northeast-1
done

The 1st to 5th were attached successfully, but the 6th produced the following error.

An error occurred (ResourceLimitExceeded) when calling the AttachImageWatermark operation:
Can't attach the watermark because the image already has the maximum number of watermarks (5).
Detach unused watermarks, and try again.

As documented, the limit is 5 per AMI.

Verifying that spoofing is not possible

I tried attaching a watermark with a name containing a colon (:) that looks like another account ID.

aws ec2 attach-image-watermark \
  --image-id ami-0b685cdf524897143 \
  --watermark-name "999999999999:prod-baseline" \
  --region ap-northeast-1
An error occurred (InvalidParameter) when calling the AttachImageWatermark operation:
The watermark name isn't valid. The name must be 3-128 characters and can contain only
letters (A-Z, a-z), numbers (0-9), spaces, and the following characters: () [] . / - ' @ _.

It resulted in an error because the colon is not an allowed character. When a valid name is specified, the server automatically prepends your own account ID as the prefix of the WatermarkKey.

aws ec2 attach-image-watermark \
  --image-id ami-0b685cdf524897143 \
  --watermark-name "prod-baseline" \
  --region ap-northeast-1
{
    "WatermarkKey": "123456789012:prod-baseline"
}

Since users cannot specify the account ID part of the WatermarkKey, it is not possible to newly attach a watermark that claims another account ID.

Enforcing governance in combination with Allowed AMIs

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-allowed-amis.html

Checking in audit mode

First, I set the ImageWatermarks condition in audit mode and checked the allowed status of AMIs.

# Enable audit mode
aws ec2 enable-allowed-images-settings \
  --allowed-images-settings-state audit-mode \
  --region ap-northeast-1

# Set the watermark condition
aws ec2 replace-image-criteria-in-allowed-images-settings \
  --image-criteria '[{"ImageWatermarks":[{"WatermarkKey":"123456789012:my-approved-ami"}]}]' \
  --region ap-northeast-1
{
    "State": "audit-mode",
    "ImageCriteria": [
        {
            "ImageWatermarks": [
                {
                    "WatermarkKey": "123456789012:my-approved-ami"
                }
            ]
        }
    ],
    "ManagedBy": "account"
}

In audit mode, AMIs get an ImageAllowed flag, but no launch restrictions are applied.

# AMI with watermark
aws ec2 describe-images --image-ids ami-0496605161386a315 \
  --query 'Images[0].ImageAllowed' --output text
# → true

# AMI without watermark (public)
aws ec2 describe-images --image-ids ami-0bc1ef7af11bba977 \
  --query 'Images[0].ImageAllowed' --output text
# → false

Launch restriction test with enabled

I switched to enabled and checked whether launches were actually allowed.

aws ec2 enable-allowed-images-settings \
  --allowed-images-settings-state enabled \
  --region ap-northeast-1

Result of trying to launch from an AMI without a watermark:

aws ec2 run-instances \
  --image-id ami-0bc1ef7af11bba977 \
  --instance-type t4g.nano \
  --subnet-id subnet-0123456789abcdef0 \
  --region ap-northeast-1
An error occurred (InvalidAMIID.NotFound) when calling the RunInstances operation:
The image id '[ami-0bc1ef7af11bba977]' does not exist

For an AMI that is not allowed, RunInstances returned InvalidAMIID.NotFound (the same error as for a nonexistent AMI), and the launch was rejected.

Result of launching from an AMI with a watermark:

aws ec2 run-instances \
  --image-id ami-0496605161386a315 \
  --instance-type t4g.nano \
  --subnet-id subnet-0123456789abcdef0 \
  --region ap-northeast-1
{
    "InstanceId": "i-0def4567abc890123",
    "State": "pending"
}

The launch from the watermarked AMI succeeded normally.

After the test, I set Allowed AMIs back to disabled.

Wildcard support

According to the documentation, the WatermarkKey specified in the ImageWatermarks condition of Allowed AMIs supports wildcards (*, ?).

{
    "ImageWatermarks": [
        {
            "WatermarkKey": "111122223333:prod-*",
            "MaximumDaysSinceWatermarkCreated": 90
        }
    ]
}

With this setting, only AMIs that have a watermark starting with prod- attached by account 111122223333 are allowed. In addition, the condition of within 90 days from WatermarkCreationTime is added, so the use of old AMIs can be restricted automatically. By standardizing naming conventions across the organization, flexible filtering becomes possible.

Operational design pattern

Based on the verification results so far, here is a configuration for incorporating AMI Watermarks into organizational governance.

┌─────────────────────────────────────────────────────┐
│ AMIビルドアカウント (111122223333)                      │
│  - EC2 Image Builder で AMI 作成                      │
│  - 作成後にウォーターマーク付与                           │
│  - IAM/SCP で DetachImageWatermark を Deny            │
└──────────────────────┬──────────────────────────────┘
                       │ AMI共有 or コピー
                       ▼
┌─────────────────────────────────────────────────────┐
│ ワークロードアカウント                                   │
│  Allowed AMIs (enabled):                             │
│    WatermarkKey: "111122223333:golden-*"             │
│  → このウォーターマーク付きAMIからのみ起動可能             │
└─────────────────────────────────────────────────────┘

Spoofing prevention: Since the account ID part of the WatermarkKey is automatically attached on the server side, no account other than the build account can create a watermark containing that account ID. By using the full key including the account ID as the condition on the Allowed AMIs side, you can restrict launches to only AMIs that have watermarks attached by approved accounts.

Removal prevention: The AMI owner can remove watermarks, but doing so means the AMI no longer satisfies the Allowed AMIs condition and instances can no longer be launched from it. Within the build account, denying ec2:DetachImageWatermark with an SCP also prevents removal caused by mistakes or insider threats.

Usable even with a single account: Allowed AMIs can be configured directly in each account. Furthermore, using Declarative Policies, you can apply it to all accounts under Organizations at once, and can also prohibit configuration changes on the account side.

Summary

AMI Watermarks is a mechanism by which provenance information is automatically carried over even after an AMI is copied or derived. Combined with Allowed AMIs, you can implement governance that permits instance launches only from AMIs that have watermarks approved by the organization. Thanks to the design in which the account ID is automatically attached on the server side, it is not possible to newly attach a watermark that claims another account ID. Since there is no additional charge, it is a feature that is easy to adopt as a foundation for AMI governance.


そのCCoE、つくって終わりになっていませんか

ガバナンスのルールも組織ポリシーも、整えた直後はちゃんと機能する。でも運用が属人化すれば、CCoEはいつのまにか形だけに。ベンダー依存から内製へ踏み出すために、中の人として実行まで伴走する。立ち上げと定着の進め方を、無料資料にまとめました。

CCoE総合支援

CCoE立ち上げ資料をダウンロード

Share this article

AWSのお困り事はクラスメソッドへ