instance_profiles
Creates, updates, deletes or gets an instance_profile resource or lists instance_profiles in a region
Overview
| Name | instance_profiles |
| Type | Resource |
| Description | Creates a new instance profile. For information about instance profiles, see Using instance profiles.For information about the number of instance profiles you can create, see object quotas in the User Guide. |
| Id | awscc.iam.instance_profiles |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
path | string | The path to the instance profile. For more information about paths, see IAM Identifiers in the IAM User Guide.This parameter is optional. If it is not included, it defaults to a slash (/).This parameter allows (through its regex pattern) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. In addition, it can contain any ASCII character from the ! ( \u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercased letters. |
roles | array | The name of the role to associate with the instance profile. Only one role can be assigned to an EC2 instance at a time, and all applications on the instance share the same role and permissions. |
instance_profile_name | string | The name of the instance profile to create.This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@- |
arn | string | |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
instance_profile_name | string | The name of the instance profile to create.This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@- |
region | string | AWS region. |
For more information, see AWS::IAM::InstanceProfile.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | instance_profiles | INSERT | Roles, region |
delete_resource | instance_profiles | DELETE | Identifier, region |
update_resource | instance_profiles | UPDATE | Identifier, PatchDocument, region |
list_resources | instance_profiles_list_only | SELECT | region |
get_resource | instance_profiles | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual instance_profile.
SELECT
region,
path,
roles,
instance_profile_name,
arn
FROM awscc.iam.instance_profiles
WHERE
region = 'us-east-1' AND
Identifier = '{{ instance_profile_name }}';
Lists all instance_profiles in a region.
SELECT
region,
instance_profile_name
FROM awscc.iam.instance_profiles_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new instance_profile resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.iam.instance_profiles (
Roles,
region
)
SELECT
'{{ roles }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.iam.instance_profiles (
Path,
Roles,
InstanceProfileName,
region
)
SELECT
'{{ path }}',
'{{ roles }}',
'{{ instance_profile_name }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: instance_profile
props:
- name: path
value: '{{ path }}'
- name: roles
value:
- '{{ roles[0] }}'
- name: instance_profile_name
value: '{{ instance_profile_name }}'
UPDATE example
Use the following StackQL query and manifest file to update a instance_profile resource, using stack-deploy.
/*+ update */
UPDATE awscc.iam.instance_profiles
SET PatchDocument = string('{{ {
"Roles": roles
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ instance_profile_name }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.iam.instance_profiles
WHERE
Identifier = '{{ instance_profile_name }}' AND
region = 'us-east-1'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
Permissions
To operate on the instance_profiles resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
iam:CreateInstanceProfile,
iam:PassRole,
iam:AddRoleToInstanceProfile,
iam:GetInstanceProfile
iam:GetInstanceProfile
iam:PassRole,
iam:RemoveRoleFromInstanceProfile,
iam:AddRoleToInstanceProfile,
iam:GetInstanceProfile
iam:GetInstanceProfile,
iam:RemoveRoleFromInstanceProfile,
iam:DeleteInstanceProfile
iam:ListInstanceProfiles