Skip to content

create_cross_account_attachment async

create_cross_account_attachment(
    name: AttachmentName,
    idempotency_token: IdempotencyToken,
    *,
    config_overrides: Optional[AsyncGlobalAcceleratorClientConfig] = None,
    principals: Optional[Principals] = None,
    resources: Optional[Resources] = None,
    tags: Optional[Tags] = None,
) -> CreateCrossAccountAttachmentResponse

Create a cross-account attachment in Global Accelerator. You create a cross-account attachment to specify the principals who have permission to work with resources in accelerators in their own account. You specify, in the same attachment, the resources that are shared.

A principal can be an Amazon Web Services account number or the Amazon Resource Name (ARN) for an accelerator. For account numbers that are listed as principals, to work with a resource listed in the attachment, you must sign in to an account specified as a principal. Then, you can work with resources that are listed, with any of your accelerators. If an accelerator ARN is listed in the cross-account attachment as a principal, anyone with permission to make updates to the accelerator can work with resources that are listed in the attachment.

Specify each principal and resource separately. To specify two CIDR address pools, list them individually under Resources, and so on. For a command line operation, for example, you might use a statement like the following:

"Resources": [{"Cidr": "169.254.60.0/24"},{"Cidr": "169.254.59.0/24"}]

For more information, see Working with cross-account attachments and resources in Global Accelerator in the Global Accelerator Developer Guide.

Parameters:

  • name (AttachmentName) –

    The name of the cross-account attachment.

  • principals (Optional[Principals], default: None ) –

    The principals to include in the cross-account attachment. A principal can be an Amazon Web Services account number or the Amazon Resource Name (ARN) for an accelerator.

  • resources (Optional[Resources], default: None ) –

    The Amazon Resource Names (ARNs) for the resources to include in the cross-account attachment. A resource can be any supported Amazon Web Services resource type for Global Accelerator or a CIDR range for a bring your own IP address (BYOIP) address pool.

  • idempotency_token (IdempotencyToken) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency—that is, the uniqueness—of the request.

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

    Add tags for a cross-account attachment.

    For more information, see Tagging in Global Accelerator in the Global Accelerator Developer Guide.

Raises:

Source code in docs_src/capo_global_accelerator/_services/async_global_accelerator.py
async def create_cross_account_attachment(
    self,
    name: "capo_global_accelerator.types.attachment_name.AttachmentName",
    idempotency_token: "capo_global_accelerator.types.idempotency_token.IdempotencyToken",
    *,
    config_overrides: Optional[AsyncGlobalAcceleratorClientConfig] = None,
    principals: Optional[
        "capo_global_accelerator.types.principals.Principals"
    ] = None,
    resources: Optional["capo_global_accelerator.types.resources.Resources"] = None,
    tags: Optional["capo_global_accelerator.types.tags.Tags"] = None,
) -> "capo_global_accelerator.types.create_cross_account_attachment_response.CreateCrossAccountAttachmentResponse":
    """<p>Create a cross-account attachment in Global Accelerator. You create a cross-account attachment to specify the <i>principals</i> who have permission to work with <i>resources</i> in accelerators in their own account. You specify, in the same attachment, the resources that are shared.</p> <p>A principal can be an Amazon Web Services account number or the Amazon Resource Name (ARN) for an accelerator. For account numbers that are listed as principals, to work with a resource listed in the attachment, you must sign in to an account specified as a principal. Then, you can work with resources that are listed, with any of your accelerators. If an accelerator ARN is listed in the cross-account attachment as a principal, anyone with permission to make updates to the accelerator can work with resources that are listed in the attachment. </p> <p>Specify each principal and resource separately. To specify two CIDR address pools, list them individually under <code>Resources</code>, and so on. For a command line operation, for example, you might use a statement like the following:</p> <p> <code> "Resources": [{"Cidr": "169.254.60.0/24"},{"Cidr": "169.254.59.0/24"}]</code> </p> <p>For more information, see <a href="https://docs.aws.amazon.com/global-accelerator/latest/dg/cross-account-resources.html"> Working with cross-account attachments and resources in Global Accelerator</a> in the <i> Global Accelerator Developer Guide</i>.</p>

    Args:
        name: <p>The name of the cross-account attachment. </p>
        principals: <p>The principals to include in the cross-account attachment. A principal can be an Amazon Web Services account number or the Amazon Resource Name (ARN) for an accelerator. </p>
        resources: <p>The Amazon Resource Names (ARNs) for the resources to include in the cross-account attachment. A resource can be any supported Amazon Web Services resource type for Global Accelerator or a CIDR range for a bring your own IP address (BYOIP) address pool. </p>
        idempotency_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency—that is, the uniqueness—of the request.</p>
        tags: <p>Add tags for a cross-account attachment.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/global-accelerator/latest/dg/tagging-in-global-accelerator.html">Tagging in Global Accelerator</a> in the <i>Global Accelerator Developer Guide</i>.</p>

    Raises:
        capo_global_accelerator.errors.access_denied_exception.AccessDeniedException: <p>You don't have access permission.</p>
        capo_global_accelerator.errors.internal_service_error_exception.InternalServiceErrorException: <p>There was an internal error for Global Accelerator.</p>
        capo_global_accelerator.errors.invalid_argument_exception.InvalidArgumentException: <p>An argument that you specified is invalid.</p>
        capo_global_accelerator.errors.limit_exceeded_exception.LimitExceededException: <p>Processing your request would cause you to exceed an Global Accelerator limit.</p>
        capo_global_accelerator.errors.transaction_in_progress_exception.TransactionInProgressException: <p>There's already a transaction in progress. Another transaction can't be processed.</p>
        capo_global_accelerator.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_global_accelerator.types.create_cross_account_attachment_request.CreateCrossAccountAttachmentRequest]",
    ) -> AsyncOperationResponse[
        "capo_global_accelerator.types.create_cross_account_attachment_response.CreateCrossAccountAttachmentResponse"
    ]:
        import capo_global_accelerator._operations.global_accelerator_v20180706.create_cross_account_attachment

        (
            output,
            http_response,
        ) = await capo_global_accelerator._operations.global_accelerator_v20180706.create_cross_account_attachment.async_create_cross_account_attachment(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateCrossAccountAttachment")
    )
    input_: capo_global_accelerator.types.create_cross_account_attachment_request.CreateCrossAccountAttachmentRequest = {
        "name": name,
        "idempotency_token": idempotency_token,
    }
    if principals is not None:
        input_["principals"] = principals
    if resources is not None:
        input_["resources"] = resources
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output