AWS SDK for Go (PILOT)
API Reference

PREVIEW DOCUMENTATION - This is a preview of a new format for the AWS SDK for Go API Reference documentation. For the current AWS SDK for Go API Reference, see https://docs.aws.amazon.com/sdk-for-go/api/.

We welcome your feedback on this new version of the documentation. Send your comments to aws-sdkdocs-feedback@amazon.com.

EC2Metadata

import "github.com/aws/aws-sdk-go/aws/ec2metadata"

type EC2Metadata struct { *client.Client }

A EC2Metadata is an EC2 Metadata service Client.

Client

Type: *client.Client

Method

Available

func (c *EC2Metadata) Available() bool

Available returns if the application has access to the EC2 Metadata service. Can be used to determine if application is running within an EC2 Instance and the metadata service is available.

GetDynamicData

func (c *EC2Metadata) GetDynamicData(p string) (string, error)

GetDynamicData uses the path provided to request information from the EC2 instance metadata service for dynamic data. The content will be returned as a string, or error if the request failed.

GetInstanceIdentityDocument

func (c *EC2Metadata) GetInstanceIdentityDocument() (EC2InstanceIdentityDocument, error)

GetInstanceIdentityDocument retrieves an identity document describing an instance. Error is returned if the request fails or is unable to parse the response.

GetMetadata

func (c *EC2Metadata) GetMetadata(p string) (string, error)

GetMetadata uses the path provided to request information from the EC2 instance metdata service. The content will be returned as a string, or error if the request failed.

GetUserData

func (c *EC2Metadata) GetUserData() (string, error)

GetUserData returns the userdata that was configured for the service. If there is no user-data setup for the EC2 instance a "NotFoundError" error code will be returned.

IAMInfo

func (c *EC2Metadata) IAMInfo() (EC2IAMInfo, error)

IAMInfo retrieves IAM info from the metadata API

Region

func (c *EC2Metadata) Region() (string, error)

Region returns the region the instance is running in.

On this page: