Dagger
Search

aws-cli

This module offers a generic interface to use AWS CLI in Dagger
as well as some high level functions that come in handy in the context of interacting with AWS from a Dagger pipeline.

Installation

dagger install github.com/felipepimentel/daggerverse/libraries/aws-cli@v0.0.0

Entrypoint

Return Type
AwsCli !
Arguments
NameTypeDefault ValueDescription
versionString -Version (image tag) to use from the official image repository as a base container.
containerContainer -Custom container to use as a base container.
regionString -Default AWS region.
Example
dagger -m github.com/felipepimentel/daggerverse/libraries/aws-cli@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
func (m *myModule) example() *AwsCli  {
	return dag.
			AwsCli()
}
@function
def example() -> dag.AwsCli:
	return (
		dag.aws_cli()
	)
@func()
example(): AwsCli {
	return dag
		.awsCli()
}

Types

AwsCli 🔗

region() 🔗

Return Type
String !
Example
dagger -m github.com/felipepimentel/daggerverse/libraries/aws-cli@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
 region
func (m *myModule) example(ctx context.Context) string  {
	return dag.
			AwsCli().
			Region(ctx)
}
@function
async def example() -> str:
	return await (
		dag.aws_cli()
		.region()
	)
@func()
async example(): Promise<string> {
	return dag
		.awsCli()
		.region()
}

container() 🔗

Return Type
Container !
Example
dagger -m github.com/felipepimentel/daggerverse/libraries/aws-cli@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
 container
func (m *myModule) example() *Container  {
	return dag.
			AwsCli().
			Container()
}
@function
def example() -> dagger.Container:
	return (
		dag.aws_cli()
		.container()
	)
@func()
example(): Container {
	return dag
		.awsCli()
		.container()
}

withRegion() 🔗

Set a region for all AWS CLI commands.

Return Type
AwsCli !
Arguments
NameTypeDefault ValueDescription
regionString !-AWS region.
Example
dagger -m github.com/felipepimentel/daggerverse/libraries/aws-cli@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
 with-region --region string
func (m *myModule) example(region string) *AwsCli  {
	return dag.
			AwsCli().
			WithRegion(region)
}
@function
def example(region: str) -> dag.AwsCli:
	return (
		dag.aws_cli()
		.with_region(region)
	)
@func()
example(region: string): AwsCli {
	return dag
		.awsCli()
		.withRegion(region)
}

withConfig() 🔗

Mount an AWS CLI config file.

Return Type
AwsCli !
Arguments
NameTypeDefault ValueDescription
sourceFile !-AWS config file.
Example
dagger -m github.com/felipepimentel/daggerverse/libraries/aws-cli@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
 with-config --source file:path
func (m *myModule) example(source *File) *AwsCli  {
	return dag.
			AwsCli().
			WithConfig(source)
}
@function
def example(source: dagger.File) -> dag.AwsCli:
	return (
		dag.aws_cli()
		.with_config(source)
	)
@func()
example(source: File): AwsCli {
	return dag
		.awsCli()
		.withConfig(source)
}

withCredentials() 🔗

Mount an AWS CLI credentials file.

Return Type
AwsCli !
Arguments
NameTypeDefault ValueDescription
sourceSecret !-AWS credentials file.
Example
dagger -m github.com/felipepimentel/daggerverse/libraries/aws-cli@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
 with-credentials --source env:MYSECRET
func (m *myModule) example(source *Secret) *AwsCli  {
	return dag.
			AwsCli().
			WithCredentials(source)
}
@function
def example(source: dagger.Secret) -> dag.AwsCli:
	return (
		dag.aws_cli()
		.with_credentials(source)
	)
@func()
example(source: Secret): AwsCli {
	return dag
		.awsCli()
		.withCredentials(source)
}

withProfile() 🔗

Set a profile for all AWS CLI commands.

Should be used with (at least) WithConfig.

Return Type
AwsCli !
Arguments
NameTypeDefault ValueDescription
profileString !-AWS profile.
Example
dagger -m github.com/felipepimentel/daggerverse/libraries/aws-cli@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
 with-profile --profile string
func (m *myModule) example(profile string) *AwsCli  {
	return dag.
			AwsCli().
			WithProfile(profile)
}
@function
def example(profile: str) -> dag.AwsCli:
	return (
		dag.aws_cli()
		.with_profile(profile)
	)
@func()
example(profile: string): AwsCli {
	return dag
		.awsCli()
		.withProfile(profile)
}

withStaticCredentials() 🔗

Set static AWS credentials.

Return Type
AwsCli !
Arguments
NameTypeDefault ValueDescription
accessKeyIdSecret !-AWS access key.
secretAccessKeySecret !-AWS secret key.
sessionTokenSecret -AWS session token (for temporary credentials).
Example
dagger -m github.com/felipepimentel/daggerverse/libraries/aws-cli@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
 with-static-credentials --access-key-id env:MYSECRET --secret-access-key env:MYSECRET
func (m *myModule) example(accessKeyId *Secret, secretAccessKey *Secret) *AwsCli  {
	return dag.
			AwsCli().
			WithStaticCredentials(accessKeyId, secretAccessKey)
}
@function
def example(access_key_id: dagger.Secret, secret_access_key: dagger.Secret) -> dag.AwsCli:
	return (
		dag.aws_cli()
		.with_static_credentials(access_key_id, secret_access_key)
	)
@func()
example(accessKeyId: Secret, secretAccessKey: Secret): AwsCli {
	return dag
		.awsCli()
		.withStaticCredentials(accessKeyId, secretAccessKey)
}

withoutStaticCredentials() 🔗

Remove previously set static AWS credentials.

Return Type
AwsCli !
Example
dagger -m github.com/felipepimentel/daggerverse/libraries/aws-cli@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
 without-static-credentials
func (m *myModule) example() *AwsCli  {
	return dag.
			AwsCli().
			WithoutStaticCredentials()
}
@function
def example() -> dag.AwsCli:
	return (
		dag.aws_cli()
		.without_static_credentials()
	)
@func()
example(): AwsCli {
	return dag
		.awsCli()
		.withoutStaticCredentials()
}

withTemporaryCredentials() 🔗

Set static AWS credentials (shorthand for WithStaticCredentials, making the session token a required parameter).

Return Type
AwsCli !
Arguments
NameTypeDefault ValueDescription
accessKeyIdSecret !-AWS access key.
secretAccessKeySecret !-AWS secret key.
sessionTokenSecret !-AWS session token (for temporary credentials).
Example
dagger -m github.com/felipepimentel/daggerverse/libraries/aws-cli@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
 with-temporary-credentials --access-key-id env:MYSECRET --secret-access-key env:MYSECRET --session-token env:MYSECRET
func (m *myModule) example(accessKeyId *Secret, secretAccessKey *Secret, sessionToken *Secret) *AwsCli  {
	return dag.
			AwsCli().
			WithTemporaryCredentials(accessKeyId, secretAccessKey, sessionToken)
}
@function
def example(access_key_id: dagger.Secret, secret_access_key: dagger.Secret, session_token: dagger.Secret) -> dag.AwsCli:
	return (
		dag.aws_cli()
		.with_temporary_credentials(access_key_id, secret_access_key, session_token)
	)
@func()
example(accessKeyId: Secret, secretAccessKey: Secret, sessionToken: Secret): AwsCli {
	return dag
		.awsCli()
		.withTemporaryCredentials(accessKeyId, secretAccessKey, sessionToken)
}

exec() 🔗

Run an AWS CLI command.

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
args[String ! ] !-Command to run (without "aws") (e.g., ["sts", "get-caller-identity"]).
Example
dagger -m github.com/felipepimentel/daggerverse/libraries/aws-cli@36e606fe6b7d1c9561dc60db82ab31614b838754 call \
 exec --args string1 --args string2
func (m *myModule) example(args []string) *Container  {
	return dag.
			AwsCli().
			Exec(args)
}
@function
def example(args: List[str]) -> dagger.Container:
	return (
		dag.aws_cli()
		.exec(args)
	)
@func()
example(args: string[]): Container {
	return dag
		.awsCli()
		.exec(args)
}