prefect.infrastructure.provisioners.ecs

Functions

console_context

console_context(value: Console) -> Generator[None, None, None]

Classes

IamPolicyResource

Represents an IAM policy resource for managing ECS tasks. Args:
  • policy_name: The name of the IAM policy. Defaults to “prefect-ecs-policy”.
Methods:

get_planned_actions

get_planned_actions(self) -> List[str]
Returns a description of the planned actions for provisioning this resource. Returns:
  • Optional[str]: A description of the planned actions for provisioning the resource, or None if provisioning is not required.

get_task_count

get_task_count(self) -> int
Returns the number of tasks that will be executed to provision this resource. Returns:
  • The number of tasks to be provisioned.

next_steps

next_steps(self) -> list[str]

provision

provision(self, policy_document: dict[str, Any], advance: Callable[[], None]) -> str
Provisions an IAM policy. Args:
  • advance: A callback function to indicate progress.
Returns:
  • The ARN (Amazon Resource Name) of the created IAM policy.

requires_provisioning

requires_provisioning(self) -> bool
Check if this resource requires provisioning. Returns:
  • True if provisioning is required, False otherwise.

IamUserResource

Represents an IAM user resource for managing ECS tasks. Args:
  • user_name: The desired name of the IAM user.
Methods:

get_planned_actions

get_planned_actions(self) -> List[str]
Returns a description of the planned actions for provisioning this resource. Returns:
  • Optional[str]: A description of the planned actions for provisioning the resource, or None if provisioning is not required.

get_task_count

get_task_count(self) -> int
Returns the number of tasks that will be executed to provision this resource. Returns:
  • The number of tasks to be provisioned.

next_steps

next_steps(self) -> list[str]

provision

provision(self, advance: Callable[[], None]) -> None
Provisions an IAM user. Args:
  • advance: A callback function to indicate progress.

requires_provisioning

requires_provisioning(self) -> bool
Check if this resource requires provisioning. Returns:
  • True if provisioning is required, False otherwise.

CredentialsBlockResource

Methods:

get_planned_actions

get_planned_actions(self) -> List[str]
Returns a description of the planned actions for provisioning this resource. Returns:
  • Optional[str]: A description of the planned actions for provisioning the resource, or None if provisioning is not required.

get_task_count

get_task_count(self) -> int
Returns the number of tasks that will be executed to provision this resource. Returns:
  • The number of tasks to be provisioned.

next_steps

next_steps(self) -> list[str]

provision

provision(self, base_job_template: Dict[str, Any], advance: Callable[[], None], client: Optional['PrefectClient'] = None)
Provisions an AWS credentials block. Will generate new credentials if the block does not already exist. Updates the aws_credentials variable in the job template to reference the block. Args:
  • base_job_template: The base job template.
  • advance: A callback function to indicate progress.
  • client: A Prefect client to use for interacting with the Prefect API.

requires_provisioning

requires_provisioning(self, client: Optional['PrefectClient'] = None) -> bool

AuthenticationResource

Methods:

get_planned_actions

get_planned_actions(self) -> List[str]
Returns a description of the planned actions for provisioning this resource. Returns:
  • Optional[str]: A description of the planned actions for provisioning the resource, or None if provisioning is not required.

get_task_count

get_task_count(self) -> int
Returns the number of tasks that will be executed to provision this resource. Returns:
  • The number of tasks to be provisioned.

next_steps

next_steps(self) -> list[str]

provision

provision(self, base_job_template: dict[str, Any], advance: Callable[[], None]) -> None
Provisions the authentication resources. Args:
  • base_job_template: The base job template of the work pool to provision infrastructure for.
  • advance: A callback function to indicate progress.

requires_provisioning

requires_provisioning(self) -> bool
Check if this resource requires provisioning. Returns:
  • True if provisioning is required, False otherwise.

resources

resources(self) -> list['ExecutionRoleResource | IamUserResource | IamPolicyResource | CredentialsBlockResource']

ClusterResource

Methods:

get_planned_actions

get_planned_actions(self) -> List[str]
Returns a description of the planned actions for provisioning this resource. Returns:
  • Optional[str]: A description of the planned actions for provisioning the resource, or None if provisioning is not required.

get_task_count

get_task_count(self) -> int
Returns the number of tasks that will be executed to provision this resource. Returns:
  • The number of tasks to be provisioned.

next_steps

next_steps(self) -> list[str]

provision

provision(self, base_job_template: dict[str, Any], advance: Callable[[], None]) -> None
Provisions an ECS cluster. Will update the cluster variable in the job template to reference the cluster. Args:
  • base_job_template: The base job template of the work pool to provision infrastructure for.
  • advance: A callback function to indicate progress.

requires_provisioning

requires_provisioning(self) -> bool
Check if this resource requires provisioning. Returns:
  • True if provisioning is required, False otherwise.

VpcResource

Methods:

get_planned_actions

get_planned_actions(self) -> List[str]
Returns a description of the planned actions for provisioning this resource. Returns:
  • Optional[str]: A description of the planned actions for provisioning the resource, or None if provisioning is not required.

get_task_count

get_task_count(self) -> int
Returns the number of tasks that will be executed to provision this resource. Returns:
  • The number of tasks to be provisioned.

next_steps

next_steps(self) -> list[str]

provision

provision(self, base_job_template: dict[str, Any], advance: Callable[[], None]) -> None
Provisions a VPC. Chooses a CIDR block to avoid conflicting with any existing VPCs. Will update the vpc_id variable in the job template to reference the VPC. Args:
  • base_job_template: The base job template of the work pool to provision infrastructure for.
  • advance: A callback function to indicate progress.

requires_provisioning

requires_provisioning(self) -> bool
Check if this resource requires provisioning. Returns:
  • True if provisioning is required, False otherwise.

ContainerRepositoryResource

Methods:

get_planned_actions

get_planned_actions(self) -> List[str]
Returns a description of the planned actions for provisioning this resource. Returns:
  • Optional[str]: A description of the planned actions for provisioning the resource, or None if provisioning is not required.

get_task_count

get_task_count(self) -> int
Returns the number of tasks that will be executed to provision this resource. Returns:
  • The number of tasks to be provisioned.

next_steps

next_steps(self) -> list[str | Panel]

provision

provision(self, base_job_template: dict[str, Any], advance: Callable[[], None]) -> None
Provisions an ECR repository. Args:
  • base_job_template: The base job template of the work pool to provision infrastructure for.
  • advance: A callback function to indicate progress.

requires_provisioning

requires_provisioning(self) -> bool
Check if this resource requires provisioning. Returns:
  • True if provisioning is required, False otherwise.

ExecutionRoleResource

Methods:

get_planned_actions

get_planned_actions(self) -> List[str]
Returns a description of the planned actions for provisioning this resource. Returns:
  • Optional[str]: A description of the planned actions for provisioning the resource, or None if provisioning is not required.

get_task_count

get_task_count(self) -> int
Returns the number of tasks that will be executed to provision this resource. Returns:
  • The number of tasks to be provisioned.

next_steps

next_steps(self) -> list[str]

provision

provision(self, base_job_template: dict[str, Any], advance: Callable[[], None]) -> str
Provisions an IAM role. Args:
  • base_job_template: The base job template of the work pool to provision infrastructure for.
  • advance: A callback function to indicate progress.

requires_provisioning

requires_provisioning(self) -> bool
Check if this resource requires provisioning. Returns:
  • True if provisioning is required, False otherwise.

ElasticContainerServicePushProvisioner

An infrastructure provisioner for ECS push work pools. Methods:

console

console(self) -> Console

console

console(self, value: Console) -> None

is_boto3_installed

is_boto3_installed() -> bool
Check if boto3 is installed.

provision

provision(self, work_pool_name: str, base_job_template: dict[str, Any]) -> dict[str, Any]
Provisions the infrastructure for an ECS push work pool. Args:
  • work_pool_name: The name of the work pool to provision infrastructure for.
  • base_job_template: The base job template of the work pool to provision infrastructure for.
Returns:
  • An updated copy base job template.