Documentation ¶
Overview ¶
Package awsimdsfs provides an interface to AWS IMDS (Instance Metadata Service), which is a service available to EC2 instances that provides information about the instance, and user data.
This filesystem's behaviour complies with fstest.TestFS.
Usage ¶
To use this filesystem, call New with a base URL. All reads from the filesystem are relative to this base URL. Only the scheme "aws+imds" is supported.
IMDS supports three kinds of data: instance metadata, user data, and dynamic data. This filesystem supports all three, available at the following paths: - /meta-data: instance metadata - /user-data: user data - /dynamic: dynamic data
Within the "/meta-data" and "/dynamic" paths, data is organized into categories. See Instance metadata categories for more information.
To scope the filesystem to a specific path, use that path on the URL. For example, for a filesystem that can only read dynamic data from the IMDS, you would use a URL like:
aws+imds:///dynamic/
Configuration ¶
The AWS Secrets Manager client is configured using the default credential chain (see https://aws.github.io/aws-sdk-go-v2/docs/configuring-sdk/#specifying-credentials for more information).
If you require more customized configuration, you can override the default client with the WithIMDSClientFS function.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var FS = fsimpl.FSProviderFunc(New, "aws+imds")
FS is used to register this filesystem with an fsimpl.FSMux
Functions ¶
func New ¶
New provides a filesystem (an fs.FS) backed by the AWS IMDS, rooted at the given URL.
A context can be given by using WithContextFS.
func WithIMDSClientFS ¶
func WithIMDSClientFS(imdsclient IMDSClient, fsys fs.FS) fs.FS
WithIMDSClientFS overrides the AWS IMDS client used by fs, if the filesystem supports it (i.e. has a WithIMDSClient method). This can be used for configuring specialized client options.
Note that this should not be used together with fsimpl.WithHTTPClientFS. If you wish only to override the HTTP client, use WithHTTPClient alone.
Types ¶
type IMDSClient ¶
type IMDSClient interface { GetDynamicData(ctx context.Context, params *imds.GetDynamicDataInput, optFns ...func(*imds.Options)) (*imds.GetDynamicDataOutput, error) GetMetadata(ctx context.Context, params *imds.GetMetadataInput, optFns ...func(*imds.Options)) (*imds.GetMetadataOutput, error) GetUserData(ctx context.Context, params *imds.GetUserDataInput, optFns ...func(*imds.Options)) (*imds.GetUserDataOutput, error) }