Dagger
Search

aws

presigned URLs, and instances that the bench launches and terminates. The
functions that read a state or make a change have no cache, so that a poll
or a second call in a session calls AWS again.

Installation

dagger install github.com/apoxy-dev/apoxy/ci/modules/aws@52b41b4937a516f1d827799b0627a8e1b267f3e3

Entrypoint

Return Type
Aws !
Arguments
NameTypeDefault ValueDescription
regionString !"us-west-2"No description provided
accessKeyIdSecret -No description provided
secretAccessKeySecret -No description provided
sessionTokenSecret -No description provided
endpointString -Replaces the AWS endpoints, for example with a local AWS fake.
Example
dagger -m github.com/apoxy-dev/apoxy/ci/modules/aws@52b41b4937a516f1d827799b0627a8e1b267f3e3 call \
 --region string
func (m *MyModule) Example(region string) *dagger.Aws  {
	return dag.
			Aws(region)
}
@function
def example(region: str, ) -> dagger.Aws:
	return (
		dag.aws(region)
	)
@func()
example(region: string, ): Aws {
	return dag
		.aws(region)
}

Types

Aws 🔗

Aws is an AWS session in one region.

region() 🔗

Return Type
String !
Example
dagger -m github.com/apoxy-dev/apoxy/ci/modules/aws@52b41b4937a516f1d827799b0627a8e1b267f3e3 call \
 --region string region
func (m *MyModule) Example(ctx context.Context, region string) string  {
	return dag.
			Aws(region).
			Region(ctx)
}
@function
async def example(region: str, ) -> str:
	return await (
		dag.aws(region)
		.region()
	)
@func()
async example(region: string, ): Promise<string> {
	return dag
		.aws(region)
		.region()
}

bucket() 🔗

Bucket returns an S3 bucket. It makes no AWS call.

Return Type
Bucket !
Arguments
NameTypeDefault ValueDescription
nameString !-No description provided
Example
dagger -m github.com/apoxy-dev/apoxy/ci/modules/aws@52b41b4937a516f1d827799b0627a8e1b267f3e3 call \
 --region string bucket --name string
func (m *MyModule) Example(region string, name string) *dagger.AwsBucket  {
	return dag.
			Aws(region).
			Bucket(name)
}
@function
def example(region: str, name: str) -> dagger.AwsBucket:
	return (
		dag.aws(region)
		.bucket(name)
	)
@func()
example(region: string, name: string): AwsBucket {
	return dag
		.aws(region)
		.bucket(name)
}

ensureBucket() 🔗

EnsureBucket makes the bucket when it does not exist, and sets its settings: no public access, TLS only, and the objects under runs/ expire after 7 days.

Return Type
Bucket !
Arguments
NameTypeDefault ValueDescription
nameString !-No description provided
Example
dagger -m github.com/apoxy-dev/apoxy/ci/modules/aws@52b41b4937a516f1d827799b0627a8e1b267f3e3 call \
 --region string ensure-bucket --name string
func (m *MyModule) Example(region string, name string) *dagger.AwsBucket  {
	return dag.
			Aws(region).
			Ensurebucket(name)
}
@function
def example(region: str, name: str) -> dagger.AwsBucket:
	return (
		dag.aws(region)
		.ensurebucket(name)
	)
@func()
example(region: string, name: string): AwsBucket {
	return dag
		.aws(region)
		.ensureBucket(name)
}

instance() 🔗

Instance returns an EC2 instance. It makes no AWS call.

Return Type
Instance !
Arguments
NameTypeDefault ValueDescription
instanceIdString !-No description provided
Example
dagger -m github.com/apoxy-dev/apoxy/ci/modules/aws@52b41b4937a516f1d827799b0627a8e1b267f3e3 call \
 --region string instance --instance-id string
func (m *MyModule) Example(region string, instanceId string) *dagger.AwsInstance  {
	return dag.
			Aws(region).
			Instance(instanceId)
}
@function
def example(region: str, instanceid: str) -> dagger.AwsInstance:
	return (
		dag.aws(region)
		.instance(instanceid)
	)
@func()
example(region: string, instanceId: string): AwsInstance {
	return dag
		.aws(region)
		.instance(instanceId)
}

launch() 🔗

Launch starts one instance that terminates when it powers off, with IMDSv2 required, and returns its ID. It tries the next subnet when a subnet has no capacity. With no subnet with subnetTag, it uses the default VPC, with the group with subnetTag in that VPC, else its default group.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
imageString !-No description provided
instanceTypeString !-No description provided
userDataSecret !-

cloud-init user data.

tags[String ! ] !-

KEY=VALUE tags of the instance and its volumes.

subnetTagString !"apoxy-perf=true"

KEY=VALUE tag of the subnets and the security group.

Example
dagger -m github.com/apoxy-dev/apoxy/ci/modules/aws@52b41b4937a516f1d827799b0627a8e1b267f3e3 call \
 --region string launch --image string --instance-type string --user-data env:MYSECRET --tags string1 --tags string2 --subnet-tag string
func (m *MyModule) Example(ctx context.Context, region string, image string, instanceType string, userData *dagger.Secret, tags []string, subnetTag string) string  {
	return dag.
			Aws(region).
			Launch(ctx, image, instanceType, userData, tags, subnetTag)
}
@function
async def example(region: str, image: str, instancetype: str, userdata: dagger.Secret, tags: List[str], subnettag: str) -> str:
	return await (
		dag.aws(region)
		.launch(image, instancetype, userdata, tags, subnettag)
	)
@func()
async example(region: string, image: string, instanceType: string, userData: Secret, tags: string[], subnetTag: string): Promise<string> {
	return dag
		.aws(region)
		.launch(image, instanceType, userData, tags, subnetTag)
}

reap() 🔗

Reap terminates the live instances with the tag whose expiry tag (RFC 3339) is in the past, and returns their IDs.

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
tagString !"apoxy-perf=true"No description provided
expiryTagString !"apoxy-perf-expires"No description provided
Example
dagger -m github.com/apoxy-dev/apoxy/ci/modules/aws@52b41b4937a516f1d827799b0627a8e1b267f3e3 call \
 --region string reap --tag string --expiry-tag string
func (m *MyModule) Example(ctx context.Context, region string, tag string, expiryTag string) []string  {
	return dag.
			Aws(region).
			Reap(ctx, tag, expiryTag)
}
@function
async def example(region: str, tag: str, expirytag: str) -> List[str]:
	return await (
		dag.aws(region)
		.reap(tag, expirytag)
	)
@func()
async example(region: string, tag: string, expiryTag: string): Promise<string[]> {
	return dag
		.aws(region)
		.reap(tag, expiryTag)
}

Bucket 🔗

Bucket is an S3 bucket.

name() 🔗

Return Type
String !
Example
dagger -m github.com/apoxy-dev/apoxy/ci/modules/aws@52b41b4937a516f1d827799b0627a8e1b267f3e3 call \
 ensure-bucket --name string \
 name
func (m *MyModule) Example(ctx context.Context, name string) string  {
	return dag.
			Aws().
			Ensurebucket(name).
			Name(ctx)
}
@function
async def example(name: str) -> str:
	return await (
		dag.aws()
		.ensurebucket(name)
		.name()
	)
@func()
async example(name: string): Promise<string> {
	return dag
		.aws()
		.ensureBucket(name)
		.name()
}

delete() 🔗

Delete deletes all keys with the prefix and returns their count.

Return Type
Integer !
Arguments
NameTypeDefault ValueDescription
prefixString !-No description provided
Example
dagger -m github.com/apoxy-dev/apoxy/ci/modules/aws@52b41b4937a516f1d827799b0627a8e1b267f3e3 call \
 ensure-bucket --name string \
 delete --prefix string
func (m *MyModule) Example(ctx context.Context, name string, prefix string) int  {
	return dag.
			Aws().
			Ensurebucket(name).
			Delete(ctx, prefix)
}
@function
async def example(name: str, prefix: str) -> int:
	return await (
		dag.aws()
		.ensurebucket(name)
		.delete(prefix)
	)
@func()
async example(name: string, prefix: string): Promise<number> {
	return dag
		.aws()
		.ensureBucket(name)
		.delete(prefix)
}

download() 🔗

Download returns the object at the key as a file.

Return Type
File !
Arguments
NameTypeDefault ValueDescription
keyString !-No description provided
Example
dagger -m github.com/apoxy-dev/apoxy/ci/modules/aws@52b41b4937a516f1d827799b0627a8e1b267f3e3 call \
 ensure-bucket --name string \
 download --key string
func (m *MyModule) Example(name string, key string) *dagger.File  {
	return dag.
			Aws().
			Ensurebucket(name).
			Download(key)
}
@function
def example(name: str, key: str) -> dagger.File:
	return (
		dag.aws()
		.ensurebucket(name)
		.download(key)
	)
@func()
example(name: string, key: string): File {
	return dag
		.aws()
		.ensureBucket(name)
		.download(key)
}

exists() 🔗

Exists tells if the key exists.

Return Type
Boolean !
Arguments
NameTypeDefault ValueDescription
keyString !-No description provided
Example
dagger -m github.com/apoxy-dev/apoxy/ci/modules/aws@52b41b4937a516f1d827799b0627a8e1b267f3e3 call \
 ensure-bucket --name string \
 exists --key string
func (m *MyModule) Example(ctx context.Context, name string, key string) bool  {
	return dag.
			Aws().
			Ensurebucket(name).
			Exists(ctx, key)
}
@function
async def example(name: str, key: str) -> bool:
	return await (
		dag.aws()
		.ensurebucket(name)
		.exists(key)
	)
@func()
async example(name: string, key: string): Promise<boolean> {
	return dag
		.aws()
		.ensureBucket(name)
		.exists(key)
}

presign() 🔗

Presign returns a URL that lets its holder GET or PUT the key until it expires.

Return Type
Secret !
Arguments
NameTypeDefault ValueDescription
keyString !-No description provided
methodString !"GET"

GET or PUT.

expiresString !"50m"

For example 50m. A URL made with session credentials ends with the session.

Example
dagger -m github.com/apoxy-dev/apoxy/ci/modules/aws@52b41b4937a516f1d827799b0627a8e1b267f3e3 call \
 ensure-bucket --name string \
 presign --key string --method string --expires string
func (m *MyModule) Example(name string, key string, method string, expires string) *dagger.Secret  {
	return dag.
			Aws().
			Ensurebucket(name).
			Presign(key, method, expires)
}
@function
def example(name: str, key: str, method: str, expires: str) -> dagger.Secret:
	return (
		dag.aws()
		.ensurebucket(name)
		.presign(key, method, expires)
	)
@func()
example(name: string, key: string, method: string, expires: string): Secret {
	return dag
		.aws()
		.ensureBucket(name)
		.presign(key, method, expires)
}

putSecret() 🔗

PutSecret puts the plaintext of a secret at the key, for example a spec with presigned URLs. Its content does not show in traces.

Return Type
Void !
Arguments
NameTypeDefault ValueDescription
keyString !-No description provided
contentsSecret !-No description provided
Example
dagger -m github.com/apoxy-dev/apoxy/ci/modules/aws@52b41b4937a516f1d827799b0627a8e1b267f3e3 call \
 ensure-bucket --name string \
 put-secret --key string --contents env:MYSECRET
func (m *MyModule) Example(ctx context.Context, name string, key string, contents *dagger.Secret)   {
	return dag.
			Aws().
			Ensurebucket(name).
			Putsecret(ctx, key, contents)
}
@function
async def example(name: str, key: str, contents: dagger.Secret) -> None:
	return await (
		dag.aws()
		.ensurebucket(name)
		.putsecret(key, contents)
	)
@func()
async example(name: string, key: string, contents: Secret): Promise<void> {
	return dag
		.aws()
		.ensureBucket(name)
		.putSecret(key, contents)
}

upload() 🔗

Upload puts the file at the key and returns the SHA-256 of its content in hex.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
keyString !-No description provided
fileFile !-No description provided
Example
dagger -m github.com/apoxy-dev/apoxy/ci/modules/aws@52b41b4937a516f1d827799b0627a8e1b267f3e3 call \
 ensure-bucket --name string \
 upload --key string --file file:path
func (m *MyModule) Example(ctx context.Context, name string, key string, file *dagger.File) string  {
	return dag.
			Aws().
			Ensurebucket(name).
			Upload(ctx, key, file)
}
@function
async def example(name: str, key: str, file: dagger.File) -> str:
	return await (
		dag.aws()
		.ensurebucket(name)
		.upload(key, file)
	)
@func()
async example(name: string, key: string, file: File): Promise<string> {
	return dag
		.aws()
		.ensureBucket(name)
		.upload(key, file)
}

Instance 🔗

Instance is an EC2 instance.

instanceId() 🔗

Return Type
String !
Example
dagger -m github.com/apoxy-dev/apoxy/ci/modules/aws@52b41b4937a516f1d827799b0627a8e1b267f3e3 call \
 instance --instance-id string \
 instance-id
func (m *MyModule) Example(ctx context.Context, instanceId string) string  {
	return dag.
			Aws().
			Instance(instanceId).
			Instanceid(ctx)
}
@function
async def example(instanceid: str) -> str:
	return await (
		dag.aws()
		.instance(instanceid)
		.instanceid()
	)
@func()
async example(instanceId: string): Promise<string> {
	return dag
		.aws()
		.instance(instanceId)
		.instanceId()
}

console() 🔗

Console returns the serial console output.

Return Type
String !
Example
dagger -m github.com/apoxy-dev/apoxy/ci/modules/aws@52b41b4937a516f1d827799b0627a8e1b267f3e3 call \
 instance --instance-id string \
 console
func (m *MyModule) Example(ctx context.Context, instanceId string) string  {
	return dag.
			Aws().
			Instance(instanceId).
			Console(ctx)
}
@function
async def example(instanceid: str) -> str:
	return await (
		dag.aws()
		.instance(instanceid)
		.console()
	)
@func()
async example(instanceId: string): Promise<string> {
	return dag
		.aws()
		.instance(instanceId)
		.console()
}

state() 🔗

State returns the instance state, for example running, or not-found.

Return Type
String !
Example
dagger -m github.com/apoxy-dev/apoxy/ci/modules/aws@52b41b4937a516f1d827799b0627a8e1b267f3e3 call \
 instance --instance-id string \
 state
func (m *MyModule) Example(ctx context.Context, instanceId string) string  {
	return dag.
			Aws().
			Instance(instanceId).
			State(ctx)
}
@function
async def example(instanceid: str) -> str:
	return await (
		dag.aws()
		.instance(instanceid)
		.state()
	)
@func()
async example(instanceId: string): Promise<string> {
	return dag
		.aws()
		.instance(instanceId)
		.state()
}

terminate() 🔗

Terminate terminates the instance.

Return Type
Void !
Example
dagger -m github.com/apoxy-dev/apoxy/ci/modules/aws@52b41b4937a516f1d827799b0627a8e1b267f3e3 call \
 instance --instance-id string \
 terminate
func (m *MyModule) Example(ctx context.Context, instanceId string)   {
	return dag.
			Aws().
			Instance(instanceId).
			Terminate(ctx)
}
@function
async def example(instanceid: str) -> None:
	return await (
		dag.aws()
		.instance(instanceid)
		.terminate()
	)
@func()
async example(instanceId: string): Promise<void> {
	return dag
		.aws()
		.instance(instanceId)
		.terminate()
}