Instance Profile
Provides an IAM instance profile.
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.iam.InstanceProfile;
import com.pulumi.aws.iam.InstanceProfileArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var assumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.effect("Allow")
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("Service")
.identifiers("ec2.amazonaws.com")
.build())
.actions("sts:AssumeRole")
.build())
.build());
var role = new Role("role", RoleArgs.builder()
.path("/")
.assumeRolePolicy(assumeRole.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
.build());
var testProfile = new InstanceProfile("testProfile", InstanceProfileArgs.builder()
.role(role.name())
.build());
}
}
Import
Instance Profiles can be imported using the name
, e.g.,
$ pulumi import aws:iam/instanceProfile:InstanceProfile test_profile app-instance-profile-1
Properties
Creation timestamp of the instance profile.
Name of the instance profile. If omitted, this provider will assign a random, unique name. Conflicts with name_prefix
. Can be a string of characters consisting of upper and lowercase alphanumeric characters and these special characters: _
, +
, =
, ,
, .
, @
, -
. Spaces are not allowed.
Creates a unique name beginning with the specified prefix. Conflicts with name
.
Path to the instance profile. For more information about paths, see IAM Identifiers in the IAM User Guide. Can be a string of characters consisting of either a forward slash (/
) by itself or a string that must begin and end with forward slashes. Can include any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercase letters.