Skip to content

EC2  >  Operations  >  associate_networking_flex_cost_allocation_policy

associate_networking_flex_cost_allocation_policy

Operation

associate_networking_flex_cost_allocation_policy async

associate_networking_flex_cost_allocation_policy(*, plugins: list[Plugin] | None = None, **kwargs: Unpack[AssociateNetworkingFlexCostAllocationPolicyInputDict]) -> AssociateNetworkingFlexCostAllocationPolicyOutput

Associates a flex cost allocation policy with one or more network resources. You can associate the policy directly with specific resources by resource ID, or you can associate it with a scope of resources in an account, Amazon VPC, or subnet.

The following limits apply:

  • A request can associate up to 20 resources.

  • A policy can have up to 100 active associations.

  • A network resource can have only one active association, across all policies. If a resource is already associated, the response includes it in the failures with the code ResourceAlreadyAssociated.

Parameters:

Name Type Description Default
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
AssociateNetworkingFlexCostAllocationPolicyOutput

An instance of AssociateNetworkingFlexCostAllocationPolicyOutput.

Input

Pass the input fields as keyword arguments, or pass a model or dictionary as the first positional argument. Pass plugins separately as a keyword argument.

Model

AssociateNetworkingFlexCostAllocationPolicyInput dataclass

Bases: _SerdeShape

Dataclass for AssociateNetworkingFlexCostAllocationPolicyInput structure.

Attributes
client_token class-attribute instance-attribute
client_token: str | None = ...

Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring idempotency.

This field is autopopulated if not provided.

dry_run class-attribute instance-attribute
dry_run: bool | None = ...

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

fca_policy_id class-attribute instance-attribute
fca_policy_id: str | None = ...

The ID of the flex cost allocation policy to associate. This parameter is required.

network_resource_ids class-attribute instance-attribute
network_resource_ids: list[str] | None = ...

The IDs of the network resources to associate with the policy. You can specify from 1 to 20 resource IDs.

You must specify NetworkResourceIds, NetworkResourceScope, or both. A request can include at most 20 distinct resources in total.

network_resource_scope class-attribute instance-attribute
network_resource_scope: FlexCostAllocationNetworkResourceScope | None = ...

The scope of network resources to associate with the policy. Use a scope to associate the policy with the resources in an account, Amazon VPC, or subnet.

You must specify NetworkResourceScope, NetworkResourceIds, or both.

Dictionaries

AssociateNetworkingFlexCostAllocationPolicyInputDict

Bases: TypedDict

Dictionary form of AssociateNetworkingFlexCostAllocationPolicyInput.

Attributes
client_token instance-attribute
client_token: str | None

Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring idempotency.

This field is autopopulated if not provided.

dry_run instance-attribute
dry_run: bool | None

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

fca_policy_id instance-attribute
fca_policy_id: Required[str]

The ID of the flex cost allocation policy to associate. This parameter is required.

network_resource_ids instance-attribute
network_resource_ids: Sequence[str] | None

The IDs of the network resources to associate with the policy. You can specify from 1 to 20 resource IDs.

You must specify NetworkResourceIds, NetworkResourceScope, or both. A request can include at most 20 distinct resources in total.

network_resource_scope instance-attribute

The scope of network resources to associate with the policy. Use a scope to associate the policy with the resources in an account, Amazon VPC, or subnet.

You must specify NetworkResourceScope, NetworkResourceIds, or both.

Output

AssociateNetworkingFlexCostAllocationPolicyOutput dataclass

Bases: _SerdeShape

Dataclass for AssociateNetworkingFlexCostAllocationPolicyOutput structure.

Attributes

fca_policy_association_failures class-attribute instance-attribute
fca_policy_association_failures: list[FlexCostAllocationOperationFailure] | None = ...

Information about the network resources that could not be associated with the policy.

fca_policy_associations class-attribute instance-attribute
fca_policy_associations: list[FlexCostAllocationPolicyAssociationDescription] | None = ...

Information about the policy associations that were created.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.