ec2

package
v0.0.0-...-955c50f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

View Source
const (

	// IdentityType is the identity type for EC2
	IdentityType = "EC2"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IEC2Identity

type IEC2Identity interface {
	InstanceID() (string, error)
	Region() (string, error)
	AvailabilityZone() (string, error)
	AvailabilityZoneId() (string, error)
	InstanceType() (string, error)
	IsIdentityEnvironment() bool
	Credentials() *credentials.Credentials
	IdentityType() string
	Register()
}

IEC2Identity defines the functions for the EC2 identity

type Identity

type Identity struct {
	Log    log.T
	Client iEC2MdsSdkClient
	Config *appconfig.SsmagentConfig

	AuthRegisterService authregister.IClient
	// contains filtered or unexported fields
}

Identity is the struct implementing the IAgentIdentityInner interface for the EC2 identity

func NewEC2Identity

func NewEC2Identity(log log.T) *Identity

NewEC2Identity initializes the ec2 identity

func NewEC2IdentityWithConfig

func NewEC2IdentityWithConfig(log log.T, imdsAwsConfig *aws.Config) *Identity

func (*Identity) AvailabilityZone

func (i *Identity) AvailabilityZone() (string, error)

AvailabilityZone returns the availabilityZone ec2 instance

func (*Identity) AvailabilityZoneId

func (i *Identity) AvailabilityZoneId() (string, error)

AvailabilityZoneId returns the availabilityZoneId ec2 instance

func (*Identity) CredentialProvider

func (i *Identity) CredentialProvider() credentialproviders.IRemoteProvider

CredentialProvider returns the initialized credentials provider

func (*Identity) Credentials

func (i *Identity) Credentials() *credentials.Credentials

Credentials initializes credentials for EC2 identity if none exists and returns credentials Since credentials expire in about 6 hours, setting the ExpiryWindow to 5 hours will trigger a refresh 5 hours before they actually expire. So the TTL of credentials is reduced to about 1 hour to match EC2 assume role frequency.

func (*Identity) IdentityType

func (i *Identity) IdentityType() string

IdentityType returns the identity type of the ec2 instance

func (*Identity) InstanceID

func (i *Identity) InstanceID() (string, error)

InstanceID returns the managed instance id

func (*Identity) InstanceIDWithContext

func (i *Identity) InstanceIDWithContext(ctx context.Context) (string, error)

InstanceIDWithContext returns the managed instance id

func (*Identity) InstanceType

func (i *Identity) InstanceType() (string, error)

InstanceType returns the instance type of the ec2 instance

func (*Identity) IsIdentityEnvironment

func (i *Identity) IsIdentityEnvironment() bool

IsIdentityEnvironment returns if instance is a ec2 instance

func (*Identity) Region

func (i *Identity) Region() (region string, err error)

Region returns the region of the ec2 instance

func (*Identity) RegionWithContext

func (i *Identity) RegionWithContext(ctx context.Context) (region string, err error)

RegionWithContext returns the region of the ec2 instance

func (*Identity) Register

func (i *Identity) Register(ctx context.Context) error

Register registers the EC2 identity with Systems Manager

func (*Identity) VpcPrimaryCIDRBlock

func (i *Identity) VpcPrimaryCIDRBlock() (ip map[string][]string, err error)

VpcPrimaryCIDRBlock returns ipv4, ipv6 VPC CIDR block addresses if exists

Directories

Path Synopsis
Package ec2detector implements the detection of EC2 using specific sub-detectors
Package ec2detector implements the detection of EC2 using specific sub-detectors
nitrodetector
Package nitrodetector implements logic to determine if we are running on an nitro hypervisor
Package nitrodetector implements logic to determine if we are running on an nitro hypervisor
xendetector
Package xendetector implements logic to determine if we are running on an amazon Xen hypervisor
Package xendetector implements logic to determine if we are running on an amazon Xen hypervisor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL