placement_group#

State module for managing EC2 placement groups.

async idem_aws.states.aws.ec2.placement_group.present(hub, ctx, name: str, resource_id: str = None, strategy: str = None, partition_count: int = None, tags: Dict[str, str] = None, spread_level: str = None) Dict[str, Any][source]#

Manage creation and updates for an EC2 placement group.

Creates a placement group in which to launch instances. The strategy of the placement group determines how the instances are organized within the group. A cluster placement group is a logical grouping of instances within a single Availability Zone that benefit from low network latency, high network throughput. A spread placement group places instances on distinct hardware. A partition placement group places groups of instances in different partitions, where instances in one partition do not share the same hardware with instances in another partition. For more information, see Placement groups in the Amazon EC2 User Guide.

Parameters:
  • name (str) – An Idem name of the resource and the GroupName of the placement group.

  • resource_id (str, Optional) – The GroupName of the placement group.

  • strategy (str, Optional) – The placement strategy. Defaults to None. May be one of the following. cluster/spread/partition

  • partition_count (int, Optional) – The number of partitions. Valid only when Strategy is set to partition. Defaults to None.

  • tags (dict or list, Optional) –

    Dict in the format of {tag-key: tag-value} or List of tags in the format of [{"Key": tag-key, "Value": tag-value}] to associate with the AMI.

    • Key (str):

      The key name that can be used to look up or retrieve the associated value. For example, Department or Cost Center are common choices.

    • Value (str):

      The value associated with this tag. For example, tags with a key name of Department could have values such as Human Resources, Accounting, and Support. Tags with a key name of Cost Center might have values that consist of the number associated with the different cost centers in your company. Typically, many resources have tags with the same key name but with different values. Amazon Web Services always interprets the tag Value as a single string. If you need to store an array, you can store comma-separated values in the string. However, you must interpret the value in your code.

  • spread_level (str, Optional) –

    Determines how placement groups spread instances.
    • Host: You can use host only with Outpost placement groups.

    • Rack: No usage restrictions. Defaults to None.

Request Syntax:
idem_placement_group_name:
  aws.ec2.placement_group.present:
    - name: value
    - strategy: cluster
Returns:

Dict[str, Any]

Examples

idem_placement_group_name:
  aws.ec2.placement_group.present:
    - name: my_placement_group_name
    - strategy: cluster
async idem_aws.states.aws.ec2.placement_group.absent(hub, ctx, name: str, resource_id: str = None) Dict[str, Any][source]#

Delete an EC2 placement group if it exists.

Deletes the specified placement group. You must terminate all instances in the placement group before you can delete the placement group. For more information, see Placement groups in the Amazon EC2 User Guide.

Parameters:
  • name (str) – An Idem name of the resource and the GroupName of the placement group

  • resource_id (str, Optional) – The GroupName of the placement group. Idem automatically considers this resource to be absent if this field is not specified.

Request Syntax:
idem_placement_group_name:
  aws.ec2.placement_group.absent:
    - name: value
    - resource_id: value
Returns:

Dict[str, Any]

Examples

idem_placement_group_name:
  aws.ec2.placement_group.absent:
    - name: my_placement_group_name
    - resource_id: my_placement_group_name
async idem_aws.states.aws.ec2.placement_group.describe(hub, ctx) Dict[str, Dict[str, Any]][source]#

Describe the resource in a way that can be recreated/managed with the corresponding “present” function.

Gets information about the AWS EC2 placement group

Returns:

Dict[str, Dict[str, Any]]

Examples

$ idem describe aws.ec2.placement_group