AWS Identity and Access Management
CLI Reference (API Version 2010-05-08)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Did this page help you?  Yes | No |  Tell us about it...

iam-instanceprofilecreate

Description

Creates a new instance profile in your AWS account. Optionally adds a role to the instance profile.

For more information about instance profiles, see About Instance Profiles in Using AWS Identity and Access Management. Working with roles is described in Working with Roles.

Syntax

iam-instanceprofilecreate [-p PATH | -r ROLENAME] -s INSTANCEPROFILENAME

Options

Name Description Required

-p PATH

Path to the instance profile. For more information about paths, go to Identifiers for IAM Entities in Using AWS Identity and Access Management. If you don't want the instance profile to have a path, set to /.

Type: String

Constraints: See Appendix A: Limitations on IAM Entities.

Default: /

No

-r ROLENAME

The name of the role to add to the instance profile.

Type: String

Default: None

Optional

-s INSTANCEPROFILENAME

Name of the instance profile.

Type: String

Constraints: See Appendix A: Limitations on IAM Entities.

Default: None

Yes

Output

The output lists the Amazon Resource Name (ARN) for the instance profile. For more information about ARNs, see ARNs in Using AWS Identity and Access Management.

Example

The following example creates an instance profile named myinstanceprofile with no path. You could omit the -p option and get the same result.

PROMPT> iam-instanceprofilecreate -s myinstanceprofile -p /
arn:aws:iam::123456789012:instance-profile/myinstanceprofile

The following example creates an instance profile named myinstanceprofile with a path of /division_abc/subdivision_xyz/, and adds a previously created role named myrole.

PROMPT> iam-instanceprofilecreate -s myinstanceprofile -p /division_abc/subdivision_xyz/ -r myrole
arn:aws:iam::123456789012:instance-profile/division_abc/subdivision_xyz/myinstanceprofile