| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
Creates an AWS Identity and Access Management (IAM) Instance Profile that can be used with IAM Roles for EC2 Instances.
For more information about IAM roles, see Working with Roles in the AWS Identity and Access Management User Guide.
{
"Type": "AWS::IAM::InstanceProfile",
"Properties": {
"Path": String,
"Roles": [ IAM Roles ]
}
} The path associated with this IAM instance profile. For information about IAM paths, see Friendly Names and Paths in the AWS Identity and Access Management User Guide.
Required: Yes
Type: String
Update requires: replacement
The roles associated with this IAM instance profile.
Required: Yes
Type: List of references to AWS::IAM::Roles. Currently, a maximum of one role can be assigned to an instance profile.
Update requires: no interruption
When the logical ID of this resource is provided to the Ref intrinsic
function, it returns the resource name. For example:
{ "Ref": "MyProfile" }For the IAM::InstanceProfile with the logical ID "MyProfile", Ref will return the
resource name.
For more information about using the Ref function, see Ref.
Fn::GetAtt returns a value for a specified attribute of this type.
This section lists the available attributes and corresponding return values.
Returns the Amazon Resource Name (ARN) for the instance profile. For example:
{"Fn::GetAtt" : ["MyProfile", "Arn"] }This will return a value such as
“arn:aws:iam::1234567890:instance-profile/MyProfile-ASDNSDLKJ”.
For more information about using Fn:GetAtt, see Fn::GetAtt.
Example IAM Role with Embedded Policy and Instance Profiles
This example shows an embedded Policy in the IAM::Role. The policy is specified inline in the IAM::Role Policies property.
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"RootRole": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [ {
"Effect": "Allow",
"Principal": {
"Service": [ "ec2.amazonaws.com" ]
},
"Action": [ "sts:AssumeRole" ]
} ]
},
"Path": "/",
"Policies": [ {
"PolicyName": "root",
"PolicyDocument": {
"Statement": [ {
"Effect": "Allow",
"Action": "*",
"Resource": "*"
} ]
}
} ]
}
},
"RootInstanceProfile": {
"Type": "AWS::IAM::InstanceProfile",
"Properties": {
"Path": "/",
"Roles": [ {
"Ref": "RootRole"
} ]
}
}
}
}