Ec2 Instance Connect Api
Ec2 Instance Connect Api
API Reference
API Version 2018-04-02
AWS EC2 Instance Connect API Reference
Amazon's trademarks and trade dress may not be used in connection with any product or service that is not
Amazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages or
discredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who may
or may not be affiliated with, connected to, or sponsored by Amazon.
Try it now and let us know what you think. Switch to the new look >>
You can return to the original look by selecting English in the language selector above.
AWS EC2 Instance Connect API Reference
Table of Contents
Welcome ........................................................................................................................................... 1
Actions ............................................................................................................................................. 2
SendSSHPublicKey ...................................................................................................................... 3
Request Syntax .................................................................................................................. 3
Request Parameters ............................................................................................................ 3
Response Syntax ................................................................................................................ 4
Response Elements ............................................................................................................. 4
Errors ............................................................................................................................... 4
See Also ............................................................................................................................ 5
Data Types ........................................................................................................................................ 6
Common Parameters .......................................................................................................................... 7
Common Errors .................................................................................................................................. 9
Welcome
Amazon EC2 Instance Connect enables system administrators to publish one-time use SSH public keys to
their EC2 instances, providing users a simple and secure way to connect to their instances.
Actions
The following actions are supported:
• SendSSHPublicKey (p. 3)
SendSSHPublicKey
Pushes an SSH public key to a particular OS user on a given EC2 instance for 60 seconds.
Request Syntax
{
"AvailabilityZone": "string",
"InstanceId": "string",
"InstanceOSUser": "string",
"SSHPublicKey": "string"
}
Request Parameters
For information about the parameters that are common to all actions, see Common
Parameters (p. 7).
AvailabilityZone (p. 3)
Type: String
Pattern: ^(\w+-){2,3}\d+\w+$
Required: Yes
InstanceId (p. 3)
The EC2 instance you wish to publish the SSH key to.
Type: String
Pattern: ^i-[a-f0-9]+$
Required: Yes
InstanceOSUser (p. 3)
The OS user on the EC2 instance whom the key may be used to authenticate as.
Type: String
Pattern: ^[A-Za-z_][A-Za-z0-9\@\._-]{0,30}[A-Za-z0-9\$_-]?$
Required: Yes
SSHPublicKey (p. 3)
The public key to be published to the instance. To use it after publication you must have the
matching private key.
Type: String
Required: Yes
Response Syntax
{
"RequestId": "string",
"Success": boolean
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
RequestId (p. 4)
The request ID as logged by EC2 Connect. Please provide this when contacting AWS Support.
Type: String
Success (p. 4)
Type: Boolean
Errors
For information about the errors that are common to all actions, see Common Errors (p. 9).
AuthException
Indicates that either your AWS credentials are invalid or you do not have access to the EC2 instance.
Indicates that the instance requested was not found in the given zone. Check that you have provided
a valid instance ID and the correct zone.
Indicates that you provided bad input. Ensure you have a valid instance ID, the correct zone, and a
valid SSH public key.
Indicates that the service encountered an error. Follow the message's instructions and try again.
Indicates you have been making requests too frequently and have been throttled. Wait for a while
and try again. If higher call volume is warranted contact AWS Support.
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
Data Types
The AWS EC2 Instance Connect API has no separate data types.
Common Parameters
The following list contains the parameters that all actions use for signing Signature Version 4 requests
with a query string. Any action-specific parameters are listed in the topic for that action. For more
information about Signature Version 4, see Signature Version 4 Signing Process in the Amazon Web
Services General Reference.
Action
Type: string
Required: Yes
Version
The API version that the request is written for, expressed in the format YYYY-MM-DD.
Type: string
Required: Yes
X-Amz-Algorithm
The hash algorithm that you used to create the request signature.
Condition: Specify this parameter when you include authentication information in a query string
instead of in the HTTP authorization header.
Type: string
Required: Conditional
X-Amz-Credential
The credential scope value, which is a string that includes your access key, the date, the region you
are targeting, the service you are requesting, and a termination string ("aws4_request"). The value is
expressed in the following format: access_key/YYYYMMDD/region/service/aws4_request.
For more information, see Task 2: Create a String to Sign for Signature Version 4 in the Amazon Web
Services General Reference.
Condition: Specify this parameter when you include authentication information in a query string
instead of in the HTTP authorization header.
Type: string
Required: Conditional
X-Amz-Date
The date that is used to create the signature. The format must be ISO 8601 basic format
(YYYYMMDD'T'HHMMSS'Z'). For example, the following date time is a valid X-Amz-Date value:
20120325T120000Z.
Condition: X-Amz-Date is optional for all requests; it can be used to override the date used for
signing requests. If the Date header is specified in the ISO 8601 basic format, X-Amz-Date is
not required. When X-Amz-Date is used, it always overrides the value of the Date header. For
more information, see Handling Dates in Signature Version 4 in the Amazon Web Services General
Reference.
Type: string
Required: Conditional
X-Amz-Security-Token
The temporary security token that was obtained through a call to AWS Security Token Service (AWS
STS). For a list of services that support temporary security credentials from AWS Security Token
Service, go to AWS Services That Work with IAM in the IAM User Guide.
Condition: If you're using temporary security credentials from the AWS Security Token Service, you
must include the security token.
Type: string
Required: Conditional
X-Amz-Signature
Specifies the hex-encoded signature that was calculated from the string to sign and the derived
signing key.
Condition: Specify this parameter when you include authentication information in a query string
instead of in the HTTP authorization header.
Type: string
Required: Conditional
X-Amz-SignedHeaders
Specifies all the HTTP headers that were included as part of the canonical request. For more
information about specifying signed headers, see Task 1: Create a Canonical Request For Signature
Version 4 in the Amazon Web Services General Reference.
Condition: Specify this parameter when you include authentication information in a query string
instead of in the HTTP authorization header.
Type: string
Required: Conditional
Common Errors
This section lists the errors common to the API actions of all AWS services. For errors specific to an API
action for this service, see the topic for that API action.
AccessDeniedException
The request processing has failed because of an unknown error, exception or failure.
The action or operation requested is invalid. Verify that the action is typed correctly.
The X.509 certificate or AWS access key ID provided does not exist in our records.
The AWS query string is malformed or does not adhere to AWS standards.
MissingAuthenticationToken
The request must contain either a valid (registered) AWS access key ID or X.509 certificate.
The request reached the service more than 15 minutes after the date stamp on the request or more
than 15 minutes after the request expiration date (such as for pre-signed URLs), or the date stamp
on the request is more than 15 minutes in the future.