> For the complete documentation index, see [llms.txt](https://docs.skeddly.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.skeddly.com/data-types/actionparameters-object/amazonattachiamroletoec2instancesparameters-object.md).

# AmazonAttachIamRoleToEc2InstancesParameters Object

## Description

Parameters for the Amazon Attach IAM Role To EC2 Instances action.

## Properties

### credentialIds

Registered credentials to use with the action. One and only one credential must be specified.

Type: Array of `string`

Required: Yes

### iamRoleName

IAM role to assign to the EC2 instances.

Type: `string`

Required: Yes

### instanceIds

Instance IDs of the EC2 instances to which assign the IAM role. Required when `instanceIdentificationMethod` is `by-instance-id`.

Type: Array of `string`

Required: Conditional

### instanceNameComparison

Comparison to use when identifying EC2 instances by `Name` tag. Required when `instanceIdentificationMethod` is `by-instance-name-tag`.

Type: [InstanceNameComparison](/data-types/instancenamecomparison-object-1.md) object.

Required: Conditional

### instanceIdentificationMethod

Method of identifying the EC2 instances.

Type: `string`

Valid Values:

* `all-instances`
* `by-instance-id`
* `by-instance-name-tag`
* `by-resource-tag`

Required: Yes

### regionNames

Regions to use with the action. One and only one region must be specified.

Type: Array of `string`

Required: Yes

### resourceTagComparison

Comparison to use when identifying instances by resource tag. Required when `instanceIdentificationMethod` is `by-resource-tag`.

Type: [ResourceTagComparison](/data-types/resourcetagcomparison-object-1.md) object.

Required: Conditional

## Sample JSON

```javascript
{
    "credentialIds": [
        "cred-00000001"
    ],
    "regionNames": [
        "us-east-1"
    ],
    "instanceIdentificationMethod": "by-instance-id",
    "instanceIds": [
        "i-11111111",
        "i-22222222"
    ],
    "iamRoleName": "MyRole"
}
```
