func (c *EC2Metadata) GetMetadataWithContext(ctx aws.Context, p string) (string, error) {
	op := &request.Operation{
		Name:       "GetMetadata",
		HTTPMethod: "GET",
		HTTPPath:   sdkuri.PathJoin("/meta-data", p),
	}
	output := &metadataOutput{}
	req := c.NewRequest(op, nil, output)
	req.SetContext(ctx)
	err := req.Send()
	return output.Content, err
}
GetMetadataWithContext uses the path provided to request information from the EC2
instance metadata service. The content will be returned as a string, or
error if the request failed.
package ec2metadata
import (
	"encoding/json"
	"fmt"
	"net/http"
	"strconv"
	"strings"
	"time"
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/request"
	"github.com/aws/aws-sdk-go/internal/sdkuri"
)
func (c *EC2Metadata) getToken(ctx aws.Context, duration time.Duration) (tokenOutput, error) {
	op := &request.Operation{
		Name:       "GetToken",
		HTTPMethod: "PUT",
		HTTPPath:   "/api/token",
	}
	var output tokenOutput
	req := c.NewRequest(op, nil, &output)
	req.SetContext(ctx)
	req.Handlers.Sign.RemoveByName(fetchTokenHandlerName)
	req.Handlers.Unmarshal.Swap(unmarshalMetadataHandlerName, unmarshalTokenHandler)
	ttl := strconv.FormatInt(int64(duration/time.Second), 10)
	req.HTTPRequest.Header.Set(ttlHeader, ttl)
	err := req.Send()
	if err != nil {
		err = awserr.NewRequestFailure(
			awserr.New(req.HTTPResponse.Status, http.StatusText(req.HTTPResponse.StatusCode), err),
			req.HTTPResponse.StatusCode, req.RequestID)
	}
	return output, err
}
func (c *EC2Metadata) GetMetadata(p string) (string, error) {
	return c.GetMetadataWithContext(aws.BackgroundContext(), p)
}