1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//! 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.
//!
//! # Examples
//!
//! ```rust
//! 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());
//! }
//! ```
extern crate rusoto;
extern crate hyper;
extern crate serde_json;
extern crate serde;
extern crate serde_derive;
use Client;
use Read;
/// Parsing for AWS metadata service
/// Error type definition
use InstanceMetadata;
use MetadataRetrievalError;
/// Retrieves the AWS instance metadata.
///
/// Accesses `http://169.254.169.254/latest/dynamic/instance-identity/document` to read metadata about the current
/// running EC2 instance. For more information, see AWS's documentation at
/// http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html
///
/// Not all metadata available via the web service is currently exposed.