Skip to content

create_capacity_provider

create_capacity_provider(
    name: CapacityProviderName,
    permissions_configuration: PermissionsConfiguration,
    compute_configuration: ComputeConfiguration,
    *,
    config_overrides: Optional[BedrockAgentCoreControlClientConfig] = None,
    description: Optional[Description] = None,
    client_token: Optional[ClientToken] = None,
    tags: Optional[TagsMap] = None,
) -> CreateCapacityProviderOutput

Creates a capacity provider. A capacity provider defines the Amazon EC2 infrastructure for AgentCore Runtime, including the operating system, allowed instance types, networking, and storage. It also specifies the IAM permissions that AgentCore uses to manage those instances.

The capacity provider name must be unique within your account. After you create the capacity provider, it enters a CREATING state and transitions to READY when it is available for use.

Parameters:

  • name (CapacityProviderName) –

    The name of the capacity provider. The name must be unique within your account.

  • description (Optional[Description], default: None ) –

    An optional description of the capacity provider. If you don't specify a description, the service creates the capacity provider without one.

  • permissions_configuration (PermissionsConfiguration) –

    The permissions configuration for the capacity provider. This specifies the IAM role that AgentCore uses to manage the Amazon EC2 instances on your behalf.

  • client_token (Optional[ClientToken], default: None ) –

    A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If you don't specify this field, a value is randomly generated for you. If this token matches a previous request, the service ignores the request, but doesn't return an error. For more information, see Ensuring idempotency.

  • tags (Optional[TagsMap], default: None ) –

    A map of tag keys and values to associate with the capacity provider. If you don't specify tags, the capacity provider is created with no tags.

  • compute_configuration (ComputeConfiguration) –

    The compute configuration for the capacity provider. This defines the Amazon EC2 compute resources used to launch instances: the operating system, allowed instance types, networking, and storage.

Raises:

Source code in docs_src/capo_bedrock_agentcore_control/_services/bedrock_agent_core_control.py
def create_capacity_provider(
    self,
    name: "capo_bedrock_agentcore_control.types.capacity_provider_name.CapacityProviderName",
    permissions_configuration: "capo_bedrock_agentcore_control.types.permissions_configuration.PermissionsConfiguration",
    compute_configuration: "capo_bedrock_agentcore_control.types.compute_configuration.ComputeConfiguration",
    *,
    config_overrides: Optional[BedrockAgentCoreControlClientConfig] = None,
    description: Optional[
        "capo_bedrock_agentcore_control.types.description.Description"
    ] = None,
    client_token: Optional[
        "capo_bedrock_agentcore_control.types.client_token.ClientToken"
    ] = None,
    tags: Optional["capo_bedrock_agentcore_control.types.tags_map.TagsMap"] = None,
) -> "capo_bedrock_agentcore_control.types.create_capacity_provider_output.CreateCapacityProviderOutput":
    """<p>Creates a capacity provider. A capacity provider defines the Amazon EC2 infrastructure for AgentCore Runtime, including the operating system, allowed instance types, networking, and storage. It also specifies the IAM permissions that AgentCore uses to manage those instances.</p> <p>The capacity provider name must be unique within your account. After you create the capacity provider, it enters a <code>CREATING</code> state and transitions to <code>READY</code> when it is available for use.</p>

    Args:
        name: <p>The name of the capacity provider. The name must be unique within your account.</p>
        description: <p>An optional description of the capacity provider. If you don't specify a description, the service creates the capacity provider without one.</p>
        permissions_configuration: <p>The permissions configuration for the capacity provider. This specifies the IAM role that AgentCore uses to manage the Amazon EC2 instances on your behalf.</p>
        client_token: <p>A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If you don't specify this field, a value is randomly generated for you. If this token matches a previous request, the service ignores the request, but doesn't return an error. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a>.</p>
        tags: <p>A map of tag keys and values to associate with the capacity provider. If you don't specify tags, the capacity provider is created with no tags.</p>
        compute_configuration: <p>The compute configuration for the capacity provider. This defines the Amazon EC2 compute resources used to launch instances: the operating system, allowed instance types, networking, and storage.</p>

    Raises:
        capo_bedrock_agentcore_control.errors.access_denied_exception.AccessDeniedException: <p>This exception is thrown when a request is denied per access permissions</p>
        capo_bedrock_agentcore_control.errors.conflict_exception.ConflictException: <p>This exception is thrown when there is a conflict performing an operation</p>
        capo_bedrock_agentcore_control.errors.internal_server_exception.InternalServerException: <p>This exception is thrown if there was an unexpected error during processing of request</p>
        capo_bedrock_agentcore_control.errors.resource_not_found_exception.ResourceNotFoundException: <p>This exception is thrown when a resource referenced by the operation does not exist</p>
        capo_bedrock_agentcore_control.errors.retryable_conflict_exception.RetryableConflictException: <p>The operation failed because of a conflicting request. Retry the request.</p>
        capo_bedrock_agentcore_control.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>This exception is thrown when a request is made beyond the service quota</p>
        capo_bedrock_agentcore_control.errors.throttling_exception.ThrottlingException: <p>This exception is thrown when the number of requests exceeds the limit</p>
        capo_bedrock_agentcore_control.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the service.</p>
        capo_bedrock_agentcore_control.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_bedrock_agentcore_control.types.create_capacity_provider_input.CreateCapacityProviderInput]",
    ) -> OperationResponse[
        "capo_bedrock_agentcore_control.types.create_capacity_provider_output.CreateCapacityProviderOutput"
    ]:
        import capo_bedrock_agentcore_control._operations.amazon_bedrock_agent_core_control.create_capacity_provider

        output, http_response = (
            capo_bedrock_agentcore_control._operations.amazon_bedrock_agent_core_control.create_capacity_provider.create_capacity_provider(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_bedrock_agentcore_control.types.create_capacity_provider_input.CreateCapacityProviderInput",
    ) -> dict[str, Any]:
        import capo_bedrock_agentcore_control.types.create_capacity_provider_input

        return capo_bedrock_agentcore_control.types.create_capacity_provider_input.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateCapacityProvider", redact_input=_redact_input),
    )
    input_: capo_bedrock_agentcore_control.types.create_capacity_provider_input.CreateCapacityProviderInput = {
        "name": name,
        "permissions_configuration": permissions_configuration,
        "compute_configuration": compute_configuration,
    }
    if description is not None:
        input_["description"] = description
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if tags is not None:
        input_["tags"] = tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output