base: github.com/grailbio/base/cloud/ec2util Index | Files

package ec2util

import "github.com/grailbio/base/cloud/ec2util"

Index

Package Files

certificates.go ec2util.go

func DecodePEMAndParseCertificate Uses

func DecodePEMAndParseCertificate(certificate string) (*x509.Certificate, error)

DecodePEMAndParseCertificate decodes the PEM encoded certificate and parses it into a x509 cert.

func GetIamInstanceProfileARN Uses

func GetIamInstanceProfileARN(output *ec2.DescribeInstancesOutput) (string, error)

GetIamInstanceProfileARN extracts the ARN from the output of a call to DescribeInstances. The ARN is expected to be non-empty.

func GetPublicIPAddress Uses

func GetPublicIPAddress(output *ec2.DescribeInstancesOutput) (string, error)

GetPublicIPAddress extracts the public IP address from the output of a call to DescribeInstances. The response is expected to be non-empty if the instance has a public IP and empty ("") if the instance is private.

func ValidateInstance Uses

func ValidateInstance(output *ec2.DescribeInstancesOutput, doc IdentityDocument, remoteAddr string) (role string, err error)

ValidateInstance checks if an EC2 instance exists and it has the expected IP. It returns the name of the instance profile (the IAM role).

Note that this validation will not work for NATed VMs.

type IdentityDocument Uses

type IdentityDocument struct {
    InstanceID  string    `json:"instanceId,omitempty"`
    AccountID   string    `json:"accountId,omitempty"`
    Region      string    `json:"region,omitempty"`
    PendingTime time.Time `json:"pendingTime,omitempty"`
}

func ParseAndVerifyIdentityDocument Uses

func ParseAndVerifyIdentityDocument(pkcs7b64 string) (*IdentityDocument, string, error)

ParseAndVerifyIdentityDocument parses and checks and identity document in PKCS#7 format. Only some relevant fields are returned.

Package ec2util imports 11 packages (graph). Updated 2019-07-04. Refresh now. Tools for package owners.