Hi. I'm new to Dagger, playing around with the Python SDK. I'm running it on an EC2 instance that has an IAM role attached and I'm using the "aws-cli" image from AWS. Running aws-cli s3 ls using docker run works, but the equivalent from dagger complains it has no credentials. Details:
This is the docker command that works:
docker run --rm -it public.ecr.aws/aws-cli/aws-cli s3 ls
This is fine, it lists my buckets using the IAM role attached to the EC2 instance.
But when I run this Python code:
import sys
import anyio
import dagger
async def main():
dgr_config = dagger.Config(log_output=sys.stdout)
async with dagger.connection(dgr_config):
s3ls = (
dagger.dag.container()
.from_("public.ecr.aws/aws-cli/aws-cli")
.with_exec(["s3", "ls"])
)
s3ls_output = await s3ls.stdout()
print(s3ls_output)
anyio.run(main)
by doing python3.11 dgr-awscli.py it results in:
Unable to locate credentials. You can configure credentials by running "aws configure".
Why? IIRC I can retrieve temporary credentials and pass those to the container via envvars, but is there a better/easier way?