/AWS1/IF_E2I=>SENDSSHPUBLICKEY()¶
About SendSSHPublicKey¶
Pushes an SSH public key to the specified EC2 instance for use by the specified user. The key remains for 60 seconds. For more information, see Connect to your Linux instance using EC2 Instance Connect in the Amazon EC2 User Guide.
Method Signature¶
METHODS /AWS1/IF_E2I~SENDSSHPUBLICKEY
IMPORTING
!IV_INSTANCEID TYPE /AWS1/E2IINSTANCEID OPTIONAL
!IV_INSTANCEOSUSER TYPE /AWS1/E2IINSTANCEOSUSER OPTIONAL
!IV_SSHPUBLICKEY TYPE /AWS1/E2ISSHPUBLICKEY OPTIONAL
!IV_AVAILABILITYZONE TYPE /AWS1/E2IAVAILABILITYZONE OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_e2isendsshpubkeyrsp
RAISING
/AWS1/CX_E2IAUTHEXCEPTION
/AWS1/CX_E2IEC2INSTNOTFOUNDEX
/AWS1/CX_E2IEC2INSTSTATEINVEX
/AWS1/CX_E2IEC2INSTUNAVAILEX
/AWS1/CX_E2IINVALIDARGSEX
/AWS1/CX_E2ISERVICEEXCEPTION
/AWS1/CX_E2ITHROTTLINGEX
/AWS1/CX_E2ICLIENTEXC
/AWS1/CX_E2ISERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_instanceid TYPE /AWS1/E2IINSTANCEID /AWS1/E2IINSTANCEID¶
The ID of the EC2 instance.
iv_instanceosuser TYPE /AWS1/E2IINSTANCEOSUSER /AWS1/E2IINSTANCEOSUSER¶
The OS user on the EC2 instance for whom the key can be used to authenticate.
iv_sshpublickey TYPE /AWS1/E2ISSHPUBLICKEY /AWS1/E2ISSHPUBLICKEY¶
The public key material. To use the public key, you must have the matching private key.
Optional arguments:¶
iv_availabilityzone TYPE /AWS1/E2IAVAILABILITYZONE /AWS1/E2IAVAILABILITYZONE¶
The Availability Zone in which the EC2 instance was launched.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_e2isendsshpubkeyrsp /AWS1/CL_E2ISENDSSHPUBKEYRSP¶
Domain /AWS1/RT_ACCOUNT_ID Primitive Type NUMC
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->sendsshpublickey(
iv_availabilityzone = |string|
iv_instanceid = |string|
iv_instanceosuser = |string|
iv_sshpublickey = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lv_requestid = lo_result->get_requestid( ).
lv_success = lo_result->get_success( ).
ENDIF.
To push an SSH key to an EC2 instance¶
The following example pushes a sample SSH public key to the EC2 instance i-abcd1234 in AZ us-west-2b for use by the instance OS user ec2-user.
DATA(lo_result) = lo_client->sendsshpublickey(
iv_availabilityzone = |us-west-2a|
iv_instanceid = |i-abcd1234|
iv_instanceosuser = |ec2-user|
iv_sshpublickey = |ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3FlHqj2eqCdrGHuA6dRjfZXQ4HX5lXEIRHaNbxEwE5Te7xNF7StwhrDtiV7IdT5fDqbRyGw/szPj3xGkNTVoElCZ2dDFb2qYZ1WLIpZwj/UhO9l2mgfjR56UojjQut5Jvn2KZ1OcyrNO0J83kCaJCV7JoVbXY79FBMUccYNY45zmv9+1FMCfY6i2jdIhwR6+yLk8oubL8lIPyq7X+6b9S0yKCkB7Peml1DvghlybpAIUrC9vofHt6XP4V1i0bImw1IlljQS+DUmULRFSccATDscCX9ajnj7Crhm0HAZC0tBPXpFdHkPwL3yzYo546SCS9LKEwz62ymxxbL9k7h09t|
).