aws-cli
This module offers a generic interface to use AWS CLI in Daggeras 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/sagikazarmark/daggerverse/aws-cli@v0.1.0
Entrypoint
Return Type
AwsCli !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
version | String | - | Version (image tag) to use from the official image repository as a base container. |
container | Container | - | Custom container to use as a base container. |
region | String | - | Default AWS region. |
Example
dagger -m github.com/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 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/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 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/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 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()
}
sts() 🔗
Amazon Elastic Container Registry (Amazon ECR) is a managed container image registry service.
Return Type
AwsCliSts !
Example
dagger -m github.com/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 call \
sts
func (m *myModule) example() *AwsCliSts {
return dag.
AwsCli().
Sts()
}
@function
def example() -> dag.AwsCliSts:
return (
dag.aws_cli()
.sts()
)
@func()
example(): AwsCliSts {
return dag
.awsCli()
.sts()
}
withRegion() 🔗
Set a region for all AWS CLI commands.
Return Type
AwsCli !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
region | String ! | - | AWS region. |
Example
dagger -m github.com/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 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
Name | Type | Default Value | Description |
---|---|---|---|
source | File ! | - | AWS config file. |
Example
dagger -m github.com/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 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
Name | Type | Default Value | Description |
---|---|---|---|
source | Secret ! | - | AWS credentials file. |
Example
dagger -m github.com/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 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
Name | Type | Default Value | Description |
---|---|---|---|
profile | String ! | - | AWS profile. |
Example
dagger -m github.com/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 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
Name | Type | Default Value | Description |
---|---|---|---|
accessKeyId | Secret ! | - | AWS access key. |
secretAccessKey | Secret ! | - | AWS secret key. |
sessionToken | Secret | - | AWS session token (for temporary credentials). |
Example
dagger -m github.com/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 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/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 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
Name | Type | Default Value | Description |
---|---|---|---|
accessKeyId | Secret ! | - | AWS access key. |
secretAccessKey | Secret ! | - | AWS secret key. |
sessionToken | Secret ! | - | AWS session token (for temporary credentials). |
Example
dagger -m github.com/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 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
Name | Type | Default Value | Description |
---|---|---|---|
args | [String ! ] ! | - | Command to run (without "aws") (e.g., ["sts", "get-caller-identity"]). |
Example
dagger -m github.com/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 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)
}
ecr() 🔗
Amazon Elastic Container Registry (Amazon ECR) is a managed container image registry service.
Return Type
AwsCliEcr !
Example
dagger -m github.com/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 call \
ecr
func (m *myModule) example() *AwsCliEcr {
return dag.
AwsCli().
Ecr()
}
@function
def example() -> dag.AwsCliEcr:
return (
dag.aws_cli()
.ecr()
)
@func()
example(): AwsCliEcr {
return dag
.awsCli()
.ecr()
}
AwsCliSts 🔗
exec() 🔗
Run an AWS CLI command.
Return Type
Container !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
args | [String ! ] ! | - | Command to run (without "aws sts"). |
Example
dagger -m github.com/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 call \
sts \
exec --args string1 --args string2
func (m *myModule) example(args []string) *Container {
return dag.
AwsCli().
Sts().
Exec(args)
}
@function
def example(args: List[str]) -> dagger.Container:
return (
dag.aws_cli()
.sts()
.exec(args)
)
@func()
example(args: string[]): Container {
return dag
.awsCli()
.sts()
.exec(args)
}
getCallerIdentity() 🔗
Returns details about the IAM user or role whose credentials are used to call the operation.
Return Type
AwsCliStsCallerIdentity !
Example
dagger -m github.com/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 call \
sts \
get-caller-identity
func (m *myModule) example() *AwsCliStsCallerIdentity {
return dag.
AwsCli().
Sts().
GetCallerIdentity()
}
@function
def example() -> dag.AwsCliStsCallerIdentity:
return (
dag.aws_cli()
.sts()
.get_caller_identity()
)
@func()
example(): AwsCliStsCallerIdentity {
return dag
.awsCli()
.sts()
.getCallerIdentity()
}
AwsCliEcr 🔗
exec() 🔗
Run an AWS CLI command.
Return Type
Container !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
args | [String ! ] ! | - | Command to run (without "aws ecr"). |
Example
dagger -m github.com/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 call \
ecr \
exec --args string1 --args string2
func (m *myModule) example(args []string) *Container {
return dag.
AwsCli().
Ecr().
Exec(args)
}
@function
def example(args: List[str]) -> dagger.Container:
return (
dag.aws_cli()
.ecr()
.exec(args)
)
@func()
example(args: string[]): Container {
return dag
.awsCli()
.ecr()
.exec(args)
}
getLoginPassword() 🔗
Retrieves an authentication token that you can use to authenticate to an Amazon ECR registry.
Return Type
Secret !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
region | String | - | AWS region (required to be set either globally or here). |
cacheTtl | String | "12h" | A Go compatible duration string to control how long the result of this call should stay in Dagger's cache. |
Example
dagger -m github.com/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 call \
ecr \
get-login-password
func (m *myModule) example() *Secret {
return dag.
AwsCli().
Ecr().
GetLoginPassword()
}
@function
def example() -> dagger.Secret:
return (
dag.aws_cli()
.ecr()
.get_login_password()
)
@func()
example(): Secret {
return dag
.awsCli()
.ecr()
.getLoginPassword()
}
login() 🔗
Create registry authentication details for an ECR registry.
Return Type
AwsCliEcrRegistry !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
accountId | String | - | Account ID to be used for assembling the registry address. (Falls back to the account ID of the caller) |
region | String | - | AWS region (required to be set either globally or here). |
passwordCacheTtl | String | "12h" | A Go compatible duration string to control how long the password should stay in Dagger's cache. |
Example
dagger -m github.com/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 call \
ecr \
login
func (m *myModule) example() *AwsCliEcrRegistry {
return dag.
AwsCli().
Ecr().
Login()
}
@function
def example() -> dag.AwsCliEcrRegistry:
return (
dag.aws_cli()
.ecr()
.login()
)
@func()
example(): AwsCliEcrRegistry {
return dag
.awsCli()
.ecr()
.login()
}
AwsCliStsCallerIdentity 🔗
userId() 🔗
Return Type
String !
Example
dagger -m github.com/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 call \
sts \
get-caller-identity \
user-id
func (m *myModule) example(ctx context.Context) string {
return dag.
AwsCli().
Sts().
GetCallerIdentity().
UserId(ctx)
}
@function
async def example() -> str:
return await (
dag.aws_cli()
.sts()
.get_caller_identity()
.user_id()
)
@func()
async example(): Promise<string> {
return dag
.awsCli()
.sts()
.getCallerIdentity()
.userId()
}
account() 🔗
Return Type
String !
Example
dagger -m github.com/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 call \
sts \
get-caller-identity \
account
func (m *myModule) example(ctx context.Context) string {
return dag.
AwsCli().
Sts().
GetCallerIdentity().
Account(ctx)
}
@function
async def example() -> str:
return await (
dag.aws_cli()
.sts()
.get_caller_identity()
.account()
)
@func()
async example(): Promise<string> {
return dag
.awsCli()
.sts()
.getCallerIdentity()
.account()
}
arn() 🔗
Return Type
String !
Example
dagger -m github.com/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 call \
sts \
get-caller-identity \
arn
func (m *myModule) example(ctx context.Context) string {
return dag.
AwsCli().
Sts().
GetCallerIdentity().
Arn(ctx)
}
@function
async def example() -> str:
return await (
dag.aws_cli()
.sts()
.get_caller_identity()
.arn()
)
@func()
async example(): Promise<string> {
return dag
.awsCli()
.sts()
.getCallerIdentity()
.arn()
}
AwsCliEcrRegistry 🔗
address() 🔗
Return Type
String !
Example
dagger -m github.com/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 call \
ecr \
login \
address
func (m *myModule) example(ctx context.Context) string {
return dag.
AwsCli().
Ecr().
Login().
Address(ctx)
}
@function
async def example() -> str:
return await (
dag.aws_cli()
.ecr()
.login()
.address()
)
@func()
async example(): Promise<string> {
return dag
.awsCli()
.ecr()
.login()
.address()
}
password() 🔗
Return Type
Secret !
Example
dagger -m github.com/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 call \
ecr \
login \
password
func (m *myModule) example() *Secret {
return dag.
AwsCli().
Ecr().
Login().
Password()
}
@function
def example() -> dagger.Secret:
return (
dag.aws_cli()
.ecr()
.login()
.password()
)
@func()
example(): Secret {
return dag
.awsCli()
.ecr()
.login()
.password()
}
auth() 🔗
Set registry authentication in a container.
Return Type
Container !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
container | Container ! | - | No description provided |
Example
dagger -m github.com/sagikazarmark/daggerverse/aws-cli@2b65b8f9797ad5d423a472825d156685d3aebd28 call \
ecr \
login \
auth --container IMAGE:TAG
func (m *myModule) example(container *Container) *Container {
return dag.
AwsCli().
Ecr().
Login().
Auth(container)
}
@function
def example(container: dagger.Container) -> dagger.Container:
return (
dag.aws_cli()
.ecr()
.login()
.auth(container)
)
@func()
example(container: Container): Container {
return dag
.awsCli()
.ecr()
.login()
.auth(container)
}