Crate aws_instance_metadata [] [src]

aws_instance_metadata is a module for retrieving instance metadata when running on AWS EC2 instances.

Instance metadata (or, meta-data) is a service that Amazon provides that uses a fixed IP address and a simple HTTP API to retrieve information about the currently running EC2 instance. This metadata is typically used for reducing the amount of configuration required in software that uses the AWS APIs. For example, the current AWS region can be retrieved so that an SDK can be configured to make API calls within that region, rather than having to configure software with the correct region explicitly.


extern crate aws_instance_metadata;

fn main() {
    let metadata = aws_instance_metadata::get().unwrap();
    println!("instance_id: {:?}", metadata.instance_id);
    println!("region: {:?}", metadata.region());
    println!("ip: {:?}", metadata.private_ip());



Parsing for AWS metadata service


Error type definition



Retrieves the AWS instance metadata.