Skip to main content
CRITICALImageBuilderSecurity

Image Builder AMI Shared With All AWS Accounts

imagebuilder-ami-public-launch-permission

What this rule checks

Detects Image Builder distribution configurations whose AMI launch permission includes the "all" user group, making the produced AMI public to every AWS account.

How to fix it

  1. 1Remove UserGroups: ["all"] from LaunchPermissionConfiguration
  2. 2Share with specific accounts (UserIds / TargetAccountIds) or your organization (OrganizationArns)
FlaggedLaunchPermissionConfiguration.UserGroups containing 'all' shares the produced AMI with every AWS account โ€” everything baked into the image (agents, credentials, code) becomes public.
import * as imagebuilder from 'aws-cdk-lib/aws-imagebuilder';

new imagebuilder.CfnDistributionConfiguration(this, 'Dist', {
  name: 'app-ami',
  distributions: [
    {
      region: 'eu-west-2',
      amiDistributionConfiguration: {
        Name: 'app-ami-{{ imagebuilder:buildDate }}',
        LaunchPermissionConfiguration: { UserGroups: ['all'] },
      },
    },
  ],
});
FixedSharing with explicit account ids (UserIds) keeps the AMI private to the intended consumers, so the finding clears.
import * as imagebuilder from 'aws-cdk-lib/aws-imagebuilder';

new imagebuilder.CfnDistributionConfiguration(this, 'Dist', {
  name: 'app-ami',
  distributions: [
    {
      region: 'eu-west-2',
      amiDistributionConfiguration: {
        Name: 'app-ami-{{ imagebuilder:buildDate }}',
        LaunchPermissionConfiguration: { UserIds: ['111122223333'] },
      },
    },
  ],
});

CDK Insights pinpoints the exact file and line in your CDK source for every finding, so you can jump straight to the fix.

Affected resource types

AWS::ImageBuilder::DistributionConfiguration

Compliance frameworks

SOC2HIPAAPCI-DSSNIST

AWS documentation

Read the AWS guidance

Intentional? Suppress this finding

Sometimes a flag is deliberate โ€” a genuinely public endpoint, say. You can dismiss imagebuilder-ami-public-launch-permission and the reason is kept in the report, not silently hidden.

In .cdk-insights.json:

{
  "ignoreRules": [
    { "id": "imagebuilder-ami-public-launch-permission", "reason": "Why this is intentional" }
  ]
}

Or inline in your CDK code:

Validations.of(scope).acknowledge({
  id: 'cdk-insights::imagebuilder-ami-public-launch-permission',
  reason: 'Why this is intentional',
});

Use the rule ID imagebuilder-ami-public-launch-permission shown above โ€” not the CDK-* ID from SARIF / GitHub code scanning. To dismiss every finding on one construct instead, use ignorePaths. Suppression docs โ†’

Catch this in your stack

$ npx cdk-insights scan

CDK Insights runs this and 136+ other rules locally against your synthesised CDK app โ€” free, no account, your code never leaves your machine.