Skip to main content

iam_instance_profile_associations

Creates, updates, deletes, gets or lists an iam_instance_profile_associations resource.

Overview

Nameiam_instance_profile_associations
TypeResource
Idaws.ec2.iam_instance_profile_associations

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
association_idstringThe ID of the association.
iam_instance_profilestringThe IAM instance profile.
instance_idstringThe ID of the instance.
statestringThe state of the association.
timestampstringThe time the IAM instance profile was associated with the instance.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_iam_instance_profile_associationsselectregionAssociationId, Filter, MaxResults, NextTokenDescribes your IAM instance profile associations.
replace_iam_instance_profile_associationreplaceIamInstanceProfile, AssociationId, regionReplaces an IAM instance profile for the specified running instance. You can use this action to change the IAM instance profile that's associated with an instance without having to disassociate the existing IAM instance profile first. Use DescribeIamInstanceProfileAssociations to get the association ID.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
AssociationIdstringThe ID of the existing IAM instance profile association.
IamInstanceProfileobjectThe IAM instance profile.
regionstringAWS region (default: us-east-1)
AssociationIdarrayThe IAM instance profile associations.
FilterarrayThe filters. instance-id - The ID of the instance. state - The state of the association (associating | associated | disassociating).
MaxResultsintegerThe maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see Pagination.
NextTokenstringThe token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.

SELECT examples

Describes your IAM instance profile associations.

SELECT
association_id,
iam_instance_profile,
instance_id,
state,
timestamp
FROM aws.ec2.iam_instance_profile_associations
WHERE region = '{{ region }}' -- required
AND AssociationId = '{{ AssociationId }}'
AND Filter = '{{ Filter }}'
AND MaxResults = '{{ MaxResults }}'
AND NextToken = '{{ NextToken }}'
;

REPLACE examples

Replaces an IAM instance profile for the specified running instance. You can use this action to change the IAM instance profile that's associated with an instance without having to disassociate the existing IAM instance profile first. Use DescribeIamInstanceProfileAssociations to get the association ID.

REPLACE aws.ec2.iam_instance_profile_associations
SET
-- No updatable properties
WHERE
IamInstanceProfile = '{{ IamInstanceProfile }}' --required
AND AssociationId = '{{ AssociationId }}' --required
AND region = '{{ region }}' --required
RETURNING
association_id,
iam_instance_profile,
instance_id,
state,
timestamp;