Pass aws_key and aws_secret to a resource #8504
Unanswered
Replies: 1 comment
-
You can specify the config schema to be from dagster import StringSource, repository, op, job, resource, ResourceDefinition
@op(required_resource_keys={"aws_resource"})
def my_op(context):
...
class AwsResourceDefinition:
def __init__(self, aws_key, aws_secret):
self.aws_key = aws_key
self.aws_secret = aws_secret
@resource(config_schema={"aws_key": StringSource, "aws_secret": StringSource})
def my_aws_resource(init_context):
return AwsResourceDefinition(
aws_key=init_context.resource_config["aws_key"],
aws_secret=init_context.resource_config["aws_secret"],
)
@job(
resource_defs={"aws_resource": my_aws_resource},
config={
"resources": {
"aws_resource": {
"config": {
"aws_key": {"env": "VERY_SECRET_ENV_VARIABLE"},
"aws_secret": {"env": "ANOTHER_VERY_SECRET_ENV_VARIABLE"},
}
}
}
},
)
def my_job():
my_op() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How do I pass my aws_key and aws_secret to a resource? I wish that was documented...
The question was originally asked in Dagster Slack.
Beta Was this translation helpful? Give feedback.
All reactions