GetAllowedImagesSettingsCommand

Gets the current state of the Allowed AMIs setting and the list of Allowed AMIs criteria at the account level in the specified Region.

The Allowed AMIs feature does not restrict the AMIs owned by your account. Regardless of the criteria you set, the AMIs created by your account will always be discoverable and usable by users in your account.

For more information, see Control the discovery and use of AMIs in Amazon EC2 with Allowed AMIs  in Amazon EC2 User Guide.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { EC2Client, GetAllowedImagesSettingsCommand } from "@aws-sdk/client-ec2"; // ES Modules import
// const { EC2Client, GetAllowedImagesSettingsCommand } = require("@aws-sdk/client-ec2"); // CommonJS import
const client = new EC2Client(config);
const input = { // GetAllowedImagesSettingsRequest
  DryRun: true || false,
};
const command = new GetAllowedImagesSettingsCommand(input);
const response = await client.send(command);
// { // GetAllowedImagesSettingsResult
//   State: "STRING_VALUE",
//   ImageCriteria: [ // ImageCriterionList
//     { // ImageCriterion
//       ImageProviders: [ // ImageProviderList
//         "STRING_VALUE",
//       ],
//     },
//   ],
//   ManagedBy: "account" || "declarative-policy",
// };

GetAllowedImagesSettingsCommand Input

Parameter
Type
Description
DryRun
boolean | undefined

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

GetAllowedImagesSettingsCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
ImageCriteria
ImageCriterion[] | undefined

The list of criteria for images that are discoverable and usable in the account in the specified Amazon Web Services Region.

ManagedBy
ManagedBy | undefined

The entity that manages the Allowed AMIs settings. Possible values include:

  • account - The Allowed AMIs settings is managed by the account.

  • declarative-policy - The Allowed AMIs settings is managed by a declarative policy and can't be modified by the account.

State
string | undefined

The current state of the Allowed AMIs setting at the account level in the specified Amazon Web Services Region.

Possible values:

  • disabled: All AMIs are allowed.

  • audit-mode: All AMIs are allowed, but the ImageAllowed field is set to true if the AMI would be allowed with the current list of criteria if allowed AMIs was enabled.

  • enabled: Only AMIs matching the image criteria are discoverable and available for use.

Throws

Name
Fault
Details
EC2ServiceException
Base exception class for all service exceptions from EC2 service.