Package: ec2metadata
Overview
Package ec2metadata provides the client for making API calls to the EC2 Metadata service.
This package's client can be disabled completely by setting the environment variable “AWS_EC2_METADATA_DISABLED=true”. This environment variable set to true instructs the SDK to disable the EC2 Metadata client. The client cannot be used while the environment variable is set to true, (case insensitive).
The endpoint of the EC2 IMDS client can be configured via the environment variable, AWS_EC2_METADATA_SERVICE_ENDPOINT when creating the client with a Session. See aws/session#Options.EC2IMDSEndpoint for more details.
Constants
-
const ServiceName = readonly
ServiceName is the name of the service.
-
Value:
"ec2metadata"
Type Summary collapse
-
EC2IAMInfo
struct
An EC2IAMInfo provides the shape for unmarshaling an IAM info from the metadata API.
-
EC2InstanceIdentityDocument
struct
An EC2InstanceIdentityDocument provides the shape for unmarshaling an instance identity document.
-
EC2Metadata
struct
A EC2Metadata is an EC2 Metadata service Client.
Function Summary collapse
-
func NewClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string, opts ...func(*client.Client)) *EC2Metadata
NewClient returns a new EC2Metadata client.
Type Details
EC2IAMInfo struct
An EC2IAMInfo provides the shape for unmarshaling an IAM info from the metadata API
EC2InstanceIdentityDocument struct
An EC2InstanceIdentityDocument provides the shape for unmarshaling an instance identity document
Function Details
func NewClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string, opts ...func(*client.Client)) *EC2Metadata
NewClient returns a new EC2Metadata client. Should be used to create a client when not using a session. Generally using just New with a session is preferred.
Will remove the URL path from the endpoint provided to ensure the EC2 IMDS client is able to communicate with the EC2 IMDS API.
If an unmodified HTTP client is provided from the stdlib default, or no client the EC2RoleProvider's EC2Metadata HTTP client's timeout will be shortened. To disable this set Config.EC2MetadataDisableTimeoutOverride to false. Enabled by default.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
// File 'aws/ec2metadata/service.go', line 81
|