https://dagster.io/ logo
#ask-community
Title
# ask-community
b

Ben Wilson

02/14/2023, 7:27 PM
Man I know this should be simple, but I'm having trouble following the documentation. Could someone help me further understand how I'm supposed to configure aws secretsmanager as a resource if I'm using a Definitions object on init? Apologies in advance if I'm being dense.
Copy code
import dagster

from dags import cf, observations, ts, pr
from models import database

defs = dagster.Definitions(
    jobs=[
        observations.import_observations.to_job(resource_defs={"database": database}),
        cf.copy.to_job(),
        ts.ts.to_job(resource_defs={"database": database}),
        pr.ss.to_job(resource_defs={"database": database})
    ],
    resources={"database": database},
)
o

owen

02/14/2023, 9:36 PM
hi @Ben Wilson! https://docs.dagster.io/_apidocs/libraries/dagster-aws#dagster_aws.secretsmanager.secretsmanager_resource has some examples of configuring this resource, but in essence it would look like:
Copy code
import dagster
from dagster_aws.secretsmanager import secretsmanager_secrets_resource

from dags import cf, observations, ts, pr
from models import database

resource_defs = {
    "database": database,
    "secrets": secretsmanager_secrets_resource.configured({
                                'region_name': 'us-west-1',
                                'secrets_tag': 'dagster',
                                'add_to_environment': True,
                            }),
}

defs = dagster.Definitions(
    jobs=[
        observations.import_observations.to_job(resource_defs={"database": database}),
        cf.copy.to_job(),
        ts.ts.to_job(resource_defs=resource_defs),
        pr.ss.to_job(resource_defs=resource_defs)
    ],
    resources=resource_defs,
)
b

Ben Wilson

02/24/2023, 2:16 PM
@owen I'm so sorry that it took me this long to reply to this. I totally missed the notification. This is really helpful. I will give it a try. Thanks so much for the help!
2 Views