Dagger
Search

aws-utils

Retrieve AWS credentials for a specific profile. Helpful for authenticating with AWS when there are multiple SSO profiles.
Get ECR credentials for authenticating of simply push container images to ECR.

Installation

dagger install github.com/mamaar/dagger-modules/aws-utils@v0.0.2

Entrypoint

Return Type
AwsUtils
Example
dagger -m github.com/mamaar/dagger-modules/aws-utils@895d482c6d43bf3b747b671e4826be43a4cf1672 call \
func (m *myModule) example() *AwsUtils  {
	return dag.
			AwsUtils()
}
@function
def example() -> dag.AwsUtils:
	return (
		dag.aws_utils()
	)
@func()
example(): AwsUtils {
	return dag
		.awsUtils()
}

Types

AwsUtils 🔗

retrieveCredentials() 🔗

RetrieveCredentials retrieves AWS credentials for the given profile

Return Type
AwsUtilsCredentials !
Arguments
NameTypeDefault ValueDescription
awsDirDirectory !-No description provided
awsProfileString !-No description provided
Example
dagger -m github.com/mamaar/dagger-modules/aws-utils@895d482c6d43bf3b747b671e4826be43a4cf1672 call \
 retrieve-credentials --aws-dir DIR_PATH --aws-profile string
func (m *myModule) example(awsDir *Directory, awsProfile string) *AwsUtilsCredentials  {
	return dag.
			AwsUtils().
			RetrieveCredentials(awsDir, awsProfile)
}
@function
def example(aws_dir: dagger.Directory, aws_profile: str) -> dag.AwsUtilsCredentials:
	return (
		dag.aws_utils()
		.retrieve_credentials(aws_dir, aws_profile)
	)
@func()
example(awsDir: Directory, awsProfile: string): AwsUtilsCredentials {
	return dag
		.awsUtils()
		.retrieveCredentials(awsDir, awsProfile)
}

getEcrToken() 🔗

GetEcrToken retrieves an ECR token for the given profile. The token consists of username, password and endpoint.

Return Type
AwsUtilsEcrToken !
Arguments
NameTypeDefault ValueDescription
awsDirDirectory !-No description provided
awsProfileString !-No description provided
Example
dagger -m github.com/mamaar/dagger-modules/aws-utils@895d482c6d43bf3b747b671e4826be43a4cf1672 call \
 get-ecr-token --aws-dir DIR_PATH --aws-profile string
func (m *myModule) example(awsDir *Directory, awsProfile string) *AwsUtilsEcrToken  {
	return dag.
			AwsUtils().
			GetEcrToken(awsDir, awsProfile)
}
@function
def example(aws_dir: dagger.Directory, aws_profile: str) -> dag.AwsUtilsEcrToken:
	return (
		dag.aws_utils()
		.get_ecr_token(aws_dir, aws_profile)
	)
@func()
example(awsDir: Directory, awsProfile: string): AwsUtilsEcrToken {
	return dag
		.awsUtils()
		.getEcrToken(awsDir, awsProfile)
}

pushToEcr() 🔗

PushToEcr pushes a container image to ECR. It returns a list of references for the pushed images.

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
containerContainer !-No description provided
awsDirDirectory !-No description provided
awsProfileString !-No description provided
imageNameString !-No description provided
tags[String ! ] !-No description provided
Example
dagger -m github.com/mamaar/dagger-modules/aws-utils@895d482c6d43bf3b747b671e4826be43a4cf1672 call \
 push-to-ecr --container IMAGE:TAG --aws-dir DIR_PATH --aws-profile string --image-name string --tags string1 --tags string2
func (m *myModule) example(ctx context.Context, container *Container, awsDir *Directory, awsProfile string, imageName string, tags []string) []string  {
	return dag.
			AwsUtils().
			PushToEcr(ctx, container, awsDir, awsProfile, imageName, tags)
}
@function
async def example(container: dagger.Container, aws_dir: dagger.Directory, aws_profile: str, image_name: str, tags: List[str]) -> List[str]:
	return await (
		dag.aws_utils()
		.push_to_ecr(container, aws_dir, aws_profile, image_name, tags)
	)
@func()
async example(container: Container, awsDir: Directory, awsProfile: string, imageName: string, tags: string[]): Promise<string[]> {
	return dag
		.awsUtils()
		.pushToEcr(container, awsDir, awsProfile, imageName, tags)
}

AwsUtilsCredentials 🔗

accessKeyId() 🔗

Return Type
String !
Example
dagger -m github.com/mamaar/dagger-modules/aws-utils@895d482c6d43bf3b747b671e4826be43a4cf1672 call \
 retrieve-credentials --aws-dir DIR_PATH --aws-profile string \
 access-key-id
func (m *myModule) example(ctx context.Context, awsDir *Directory, awsProfile string) string  {
	return dag.
			AwsUtils().
			RetrieveCredentials(awsDir, awsProfile).
			AccessKeyId(ctx)
}
@function
async def example(aws_dir: dagger.Directory, aws_profile: str) -> str:
	return await (
		dag.aws_utils()
		.retrieve_credentials(aws_dir, aws_profile)
		.access_key_id()
	)
@func()
async example(awsDir: Directory, awsProfile: string): Promise<string> {
	return dag
		.awsUtils()
		.retrieveCredentials(awsDir, awsProfile)
		.accessKeyId()
}

secretAccessKey() 🔗

Return Type
String !
Example
dagger -m github.com/mamaar/dagger-modules/aws-utils@895d482c6d43bf3b747b671e4826be43a4cf1672 call \
 retrieve-credentials --aws-dir DIR_PATH --aws-profile string \
 secret-access-key
func (m *myModule) example(ctx context.Context, awsDir *Directory, awsProfile string) string  {
	return dag.
			AwsUtils().
			RetrieveCredentials(awsDir, awsProfile).
			SecretAccessKey(ctx)
}
@function
async def example(aws_dir: dagger.Directory, aws_profile: str) -> str:
	return await (
		dag.aws_utils()
		.retrieve_credentials(aws_dir, aws_profile)
		.secret_access_key()
	)
@func()
async example(awsDir: Directory, awsProfile: string): Promise<string> {
	return dag
		.awsUtils()
		.retrieveCredentials(awsDir, awsProfile)
		.secretAccessKey()
}

sessionToken() 🔗

Return Type
String !
Example
dagger -m github.com/mamaar/dagger-modules/aws-utils@895d482c6d43bf3b747b671e4826be43a4cf1672 call \
 retrieve-credentials --aws-dir DIR_PATH --aws-profile string \
 session-token
func (m *myModule) example(ctx context.Context, awsDir *Directory, awsProfile string) string  {
	return dag.
			AwsUtils().
			RetrieveCredentials(awsDir, awsProfile).
			SessionToken(ctx)
}
@function
async def example(aws_dir: dagger.Directory, aws_profile: str) -> str:
	return await (
		dag.aws_utils()
		.retrieve_credentials(aws_dir, aws_profile)
		.session_token()
	)
@func()
async example(awsDir: Directory, awsProfile: string): Promise<string> {
	return dag
		.awsUtils()
		.retrieveCredentials(awsDir, awsProfile)
		.sessionToken()
}

region() 🔗

Return Type
String !
Example
dagger -m github.com/mamaar/dagger-modules/aws-utils@895d482c6d43bf3b747b671e4826be43a4cf1672 call \
 retrieve-credentials --aws-dir DIR_PATH --aws-profile string \
 region
func (m *myModule) example(ctx context.Context, awsDir *Directory, awsProfile string) string  {
	return dag.
			AwsUtils().
			RetrieveCredentials(awsDir, awsProfile).
			Region(ctx)
}
@function
async def example(aws_dir: dagger.Directory, aws_profile: str) -> str:
	return await (
		dag.aws_utils()
		.retrieve_credentials(aws_dir, aws_profile)
		.region()
	)
@func()
async example(awsDir: Directory, awsProfile: string): Promise<string> {
	return dag
		.awsUtils()
		.retrieveCredentials(awsDir, awsProfile)
		.region()
}

AwsUtilsEcrToken 🔗

username() 🔗

Return Type
String !
Example
dagger -m github.com/mamaar/dagger-modules/aws-utils@895d482c6d43bf3b747b671e4826be43a4cf1672 call \
 get-ecr-token --aws-dir DIR_PATH --aws-profile string \
 username
func (m *myModule) example(ctx context.Context, awsDir *Directory, awsProfile string) string  {
	return dag.
			AwsUtils().
			GetEcrToken(awsDir, awsProfile).
			Username(ctx)
}
@function
async def example(aws_dir: dagger.Directory, aws_profile: str) -> str:
	return await (
		dag.aws_utils()
		.get_ecr_token(aws_dir, aws_profile)
		.username()
	)
@func()
async example(awsDir: Directory, awsProfile: string): Promise<string> {
	return dag
		.awsUtils()
		.getEcrToken(awsDir, awsProfile)
		.username()
}

password() 🔗

Return Type
String !
Example
dagger -m github.com/mamaar/dagger-modules/aws-utils@895d482c6d43bf3b747b671e4826be43a4cf1672 call \
 get-ecr-token --aws-dir DIR_PATH --aws-profile string \
 password
func (m *myModule) example(ctx context.Context, awsDir *Directory, awsProfile string) string  {
	return dag.
			AwsUtils().
			GetEcrToken(awsDir, awsProfile).
			Password(ctx)
}
@function
async def example(aws_dir: dagger.Directory, aws_profile: str) -> str:
	return await (
		dag.aws_utils()
		.get_ecr_token(aws_dir, aws_profile)
		.password()
	)
@func()
async example(awsDir: Directory, awsProfile: string): Promise<string> {
	return dag
		.awsUtils()
		.getEcrToken(awsDir, awsProfile)
		.password()
}

endpoint() 🔗

Return Type
String !
Example
dagger -m github.com/mamaar/dagger-modules/aws-utils@895d482c6d43bf3b747b671e4826be43a4cf1672 call \
 get-ecr-token --aws-dir DIR_PATH --aws-profile string \
 endpoint
func (m *myModule) example(ctx context.Context, awsDir *Directory, awsProfile string) string  {
	return dag.
			AwsUtils().
			GetEcrToken(awsDir, awsProfile).
			Endpoint(ctx)
}
@function
async def example(aws_dir: dagger.Directory, aws_profile: str) -> str:
	return await (
		dag.aws_utils()
		.get_ecr_token(aws_dir, aws_profile)
		.endpoint()
	)
@func()
async example(awsDir: Directory, awsProfile: string): Promise<string> {
	return dag
		.awsUtils()
		.getEcrToken(awsDir, awsProfile)
		.endpoint()
}