Package software.amazon.awssdk.imds
Interface Ec2MetadataClient
-
- All Superinterfaces:
AutoCloseable,SdkAutoCloseable
- All Known Implementing Classes:
DefaultEc2MetadataClient
public interface Ec2MetadataClient extends SdkAutoCloseable
Interface to represent the Ec2Metadata Client Class. Used to access instance metadata from a running EC2 instance.Instantiate the Ec2MetadataClient
Default configuration
Custom configuration
Example of a client configured for using IPV6 and a fixed delay for retry attempts :Use the client
To retrieve EC2 Instance Metadata, call thegetmethod on the client with a path to an instance metadata:Closing the client
Once all operations are done, you may close the client to free any resources used by it.
Note: A single client instance should be reused for multiple requests when possible.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceEc2MetadataClient.BuilderThe builder definition for aEc2MetadataClient.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static Ec2MetadataClient.Builderbuilder()Creates a default builder forEc2MetadataClient.static Ec2MetadataClientcreate()Create anEc2MetadataClientinstance using the default values.Ec2MetadataResponseget(String path)Gets the specified instance metadata value by the given path.-
Methods inherited from interface software.amazon.awssdk.utils.SdkAutoCloseable
close
-
-
-
-
Method Detail
-
get
Ec2MetadataResponse get(String path)
Gets the specified instance metadata value by the given path. For more information about instance metadata, check the Instance metadata documentation- Parameters:
path- Input path- Returns:
- Instance metadata value as part of MetadataResponse Object
-
create
static Ec2MetadataClient create()
Create anEc2MetadataClientinstance using the default values.- Returns:
- the client instance.
-
builder
static Ec2MetadataClient.Builder builder()
Creates a default builder forEc2MetadataClient.
-
-