DisableAllowedImagesSettingsCommand

Disables Allowed AMIs for your account in the specified Amazon Web Services Region. When set to disabled, the image criteria in your Allowed AMIs settings do not apply, and no restrictions are placed on AMI discoverability or usage. Users in your account can launch instances using any public AMI or AMI shared with your account.

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, DisableAllowedImagesSettingsCommand } from "@aws-sdk/client-ec2"; // ES Modules import
// const { EC2Client, DisableAllowedImagesSettingsCommand } = require("@aws-sdk/client-ec2"); // CommonJS import
const client = new EC2Client(config);
const input = { // DisableAllowedImagesSettingsRequest
  DryRun: true || false,
};
const command = new DisableAllowedImagesSettingsCommand(input);
const response = await client.send(command);
// { // DisableAllowedImagesSettingsResult
//   AllowedImagesSettingsState: "disabled",
// };

DisableAllowedImagesSettingsCommand 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.

DisableAllowedImagesSettingsCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
AllowedImagesSettingsState
AllowedImagesSettingsDisabledState | undefined

Returns disabled if the request succeeds; otherwise, it returns an error.

Throws

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