Matt Alhonte
11/09/2023, 3:58 AMECSTask
block fresh every time, but that's not quite working with the ECS Push worker.Marvin
11/09/2023, 3:58 AMNate
11/09/2023, 3:59 AMMatt Alhonte
11/09/2023, 4:02 AMECSTask
like so
full_ecs_args = make_ec2_args(memory, user, full_image, cpu)
ecs_task_block = ECSTask(**full_ecs_args)
and then pass that to the infrastructure
arg of Deployment.build_from_flow
Matt Alhonte
11/09/2023, 4:04 AMAWS_ACCESS_KEY_ID
, AWS_SECRET_ACCESS_KEY
, and AWS_SESSION_TOKEN
set as environment variablesNate
11/09/2023, 4:04 AMMatt Alhonte
11/09/2023, 4:06 AMcreds = boto3.session.Session().get_credentials().get_frozen_credentials()
credentials = AwsCredentials(
**{
"aws_access_key_id": creds.access_key,
"aws_secret_access_key": creds.secret_key,
"aws_session_token": creds.token,
"region_name": "us-west-2"
}
)
and then passing the object as aws_credentials
to the dictionary I pass to job_variables
in .deploy
Matt Alhonte
11/09/2023, 4:06 AMNate
11/09/2023, 4:09 AMclass AwsCredentials:
refresh_token_fn: Optional[Callable] = None
@validator
def get_refreshed_token(cls, v):
# load from somewhere at instantiation time
if refresh_token_fn:
return refresh_token_fn()
return v
which one could test quickly by subclassing AwsCredentials
and tacking these things onMatt Alhonte
11/09/2023, 4:09 AMNate
11/09/2023, 4:09 AMMatt Alhonte
11/09/2023, 4:10 AM