/AWS1/IF_EC2=>REPLACEIMAGEINSTANCETYPESPEC()¶
About ReplaceImageInstanceTypeSpecification¶
Replaces or removes the instance type specification for an AMI. The instance type specification defines which instance types are compatible with the AMI.
When you launch an instance using
RunInstances, Amazon EC2 validates the requested instance type against the AMI's
instance type specification. If the instance type is not compatible, the request fails with an
InvalidParameterCombination error.
You can specify supported instance types, unsupported instance types, or both. The evaluation logic is as follows:
-
No specification set – all instance types are allowed.
-
Only
UnsupportedInstanceTypesset – All instance types are allowed except those that match the unsupported list. -
SupportedInstanceTypesset – The instance type must match the supported list and must not match the unsupported list.
Instance type entries support wildcard patterns using * (for example,
t3.* matches all t3 sizes).
To remove an existing instance type specification, omit the
InstanceTypeSpecification parameter or set it to null.
To set the instance type specification, you must be the AMI owner. You cannot set an instance type specification on an AMI that is listed in Amazon Web Services Marketplace, and you cannot list an AMI in Amazon Web Services Marketplace if it has an instance type specification set.
Method Signature¶
METHODS /AWS1/IF_EC2~REPLACEIMAGEINSTANCETYPESPEC
IMPORTING
!IV_IMAGEID TYPE /AWS1/EC2IMAGEID OPTIONAL
!IO_INSTANCETYPESPECIFICATION TYPE REF TO /AWS1/CL_EC2INSTTYPESPECREQ OPTIONAL
!IV_DRYRUN TYPE /AWS1/EC2BOOLEAN OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_ec2rplimginsttyspecrs
RAISING
/AWS1/CX_EC2CLIENTEXC
/AWS1/CX_EC2SERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_imageid TYPE /AWS1/EC2IMAGEID /AWS1/EC2IMAGEID¶
The ID of the AMI.
Optional arguments:¶
io_instancetypespecification TYPE REF TO /AWS1/CL_EC2INSTTYPESPECREQ /AWS1/CL_EC2INSTTYPESPECREQ¶
The instance type specification to set on the AMI. Omit this parameter to remove the existing instance type specification.
iv_dryrun TYPE /AWS1/EC2BOOLEAN /AWS1/EC2BOOLEAN¶
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 isUnauthorizedOperation.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_ec2rplimginsttyspecrs /AWS1/CL_EC2RPLIMGINSTTYSPECRS¶
Examples¶
Syntax Example¶
This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.
DATA(lo_result) = lo_client->replaceimageinstancetypespec(
io_instancetypespecification = new /aws1/cl_ec2insttypespecreq(
it_supportedinstancetypes = VALUE /aws1/cl_ec2supinsttypereqet_w=>tt_suppinstancetyperequestset(
( new /aws1/cl_ec2supinsttypereqet_w( |string| ) )
)
it_unsupportedinstancetypes = VALUE /aws1/cl_ec2unsinsttypereqet_w=>tt_unspprtdinsttyperequestset(
( new /aws1/cl_ec2unsinsttypereqet_w( |string| ) )
)
)
iv_dryrun = ABAP_TRUE
iv_imageid = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lv_boolean = lo_result->get_returnvalue( ).
ENDIF.