"""Amazon Fargate connector.""" import boto3 from product_workflow import config from product_workflow.connectors.utils import get_network_config def run_task(task_name): """Runs the Fargate task with the provided name.""" client = boto3.client('ecs', region_name=config.AWS_REGION) client.run_task( cluster=task_name, count=1, launchType='FARGATE', networkConfiguration=get_network_config(), tags=[ { 'key': 'environment', 'value': config.ENVIRONMENT }, { 'key': 'service_name', 'value': config.SERVICE_NAME, }, ], # Always run the latest task definition; do not specify a revision number taskDefinition=task_name )