This documentation references AWS ParallelCluster. For running HPC and AI workloads, we recommend AWS Parallel Computing Service (AWS PCS)
AWS Identity and Access Management permissions in AWS ParallelCluster
AWS ParallelCluster uses IAM permissions to control access to resources when creating and managing clusters.
To create and manage clusters in an AWS account, AWS ParallelCluster requires permissions at two levels:
-
Permissions that the
pclusteruser requires to invoke thepclusterCLI commands for creating and managing clusters. -
Permissions that the cluster resources require to perform cluster actions.
AWS ParallelCluster uses an Amazon EC2 instance profile and role to provide cluster resource permissions. To manage cluster resource permissions, AWS ParallelCluster also requires permissions to IAM resources. For more information, see AWS ParallelCluster user example policies for managing IAM resources.
pcluster users require IAM permissions to use the pcluster CLI to create and manage a cluster and its
resources. These permissions are included in IAM policies that can be added to a user or role. For more information on IAM roles, see Creating a user role in the AWS Identity and Access Management User Guide.
You can also use AWS ParallelCluster configuration parameters to manage IAM permissions.
The following sections contain the required permissions with examples.
To use the example policies, replace , <REGION>, and similar strings with the appropriate values.<AWS
ACCOUNT ID>
The following example policies include Amazon Resource Names (ARNs) for the resources. If
you're working in the AWS GovCloud (US) or AWS China partitions, the ARNs must be changed. Specifically, they must be
changed from "arn:aws" to "arn:aws-us-gov" for the AWS GovCloud (US) partition or "arn:aws-cn" for the AWS China
partition. For more information, see Amazon Resource Names (ARNs) in AWS GovCloud (US)
Regions in the AWS GovCloud (US) User Guide and ARNs for AWS services in China
You can track changes to the example policies in AWS ParallelCluster
documentation on GitHub
Topics
AWS ParallelCluster Amazon EC2 instance roles
When you create a cluster with the default configuration settings, AWS ParallelCluster uses Amazon EC2 instance profiles to automatically create a default cluster Amazon EC2 instance role that provides the permissions required to create and manage the cluster and its resources.
Alternatives to using the default AWS ParallelCluster instance role
In place of the default AWS ParallelCluster instance role, you can use the InstanceRole cluster configuration setting to specify your
own existing IAM role for EC2. For more information, see AWS ParallelCluster configuration parameters to manage IAM permissions.
Typically, you specify existing IAM roles to fully control the permissions granted to EC2.
If your intent is to add extra policies to the default instance role, we recommend that you pass the additional IAM policies by using the
AdditionalIamPolicies configuration setting instead of InstanceProfile or InstanceRole settings.
You can update AdditionalIamPolicies when you update your cluster, however, you can't update the InstanceRole when you update your cluster.
AWS ParallelCluster example pcluster user policies
The following examples show the user policies required to create and manage AWS ParallelCluster and its resources by using the pcluster CLI.
You can attach policies to a user or role.
Topics
Base AWS ParallelCluster pcluster user policy
The following policy shows the permissions required to run AWS ParallelCluster pcluster commands.
To have AWS ParallelCluster validate the secrets that you specify in your cluster configuration, such as
DirectoryService / PasswordSecretArn and
MungeKeySecretArn, before it creates the cluster,
grant the secretsmanager:DescribeSecret and secretsmanager:GetSecretValue permissions.
If you omit those permissions, the validation is skipped.
To improve your security posture, scope down these permissions to only the secrets that you specify in your cluster configuration.
If existing Amazon EFS file systems are the only file systems used in your cluster, you can scope down the example Amazon EFS policy statements to the specific file systems referenced in the SharedStorage section of the cluster configuration file.
Additional AWS ParallelCluster pcluster user policy when using AWS Batch scheduler
AWS ParallelCluster version 3.15.1 and earlier supports AWS Batch as a scheduler.
In case you need to create and manage a cluster with AWS Batch scheduler, the following additional policy is required.
Additional AWS ParallelCluster pcluster user policy when using login nodes
To create and manage a cluster with LoginNodes, add the following policy to the
pcluster user. This policy grants the permissions to create the required service-linked roles and to manage
the Auto Scaling groups and load balancers that the login nodes use:
{ "Version": "2012-10-17", "Statement": [ { "Action": [ "iam:CreateServiceLinkedRole", "iam:DeleteServiceLinkedRole" ], "Resource": "*", "Effect": "Allow", "Condition": { "StringEquals": { "iam:AWSServiceName": [ "elasticloadbalancing.amazonaws.com", "autoscaling.amazonaws.com" ] } }, "Sid": "LoginNodesServiceLinkedRoles" }, { "Action": [ "autoscaling:DeleteAutoScalingGroup", "autoscaling:DeleteLifecycleHook", "autoscaling:DescribeAutoScalingGroups", "autoscaling:DescribeLifecycleHooks", "autoscaling:DescribeScalingActivities", "autoscaling:PutLifecycleHook", "autoscaling:UpdateAutoScalingGroup", "elasticloadbalancing:DescribeTags", "elasticloadbalancing:DeleteListener", "elasticloadbalancing:DeleteLoadBalancer", "elasticloadbalancing:DeleteTargetGroup", "elasticloadbalancing:DescribeListeners", "elasticloadbalancing:DescribeLoadBalancers", "elasticloadbalancing:DescribeTargetGroups", "elasticloadbalancing:DescribeTargetHealth", "elasticloadbalancing:ModifyLoadBalancerAttributes" ], "Resource": "*", "Effect": "Allow", "Condition": { "ForAllValues:StringEquals": { "aws:TagKeys": [ "parallelcluster:cluster-name" ] } }, "Sid": "LoginNodesFunctionalities" }, { "Action": [ "elasticloadbalancing:CreateListener", "elasticloadbalancing:CreateTargetGroup" ], "Resource": "*", "Effect": "Allow", "Condition": { "Null": { "aws:RequestTag/parallelcluster:cluster-name": "false" } }, "Sid": "LoginNodesFunctionalitiesCondition2" }, { "Action": [ "autoscaling:CreateAutoScalingGroup", "autoscaling:DeleteTags", "autoscaling:CreateOrUpdateTags", "elasticloadbalancing:AddTags", "elasticloadbalancing:RemoveTags", "elasticloadbalancing:ModifyTargetGroup", "elasticloadbalancing:CreateLoadBalancer" ], "Resource": "*", "Effect": "Allow", "Sid": "LoginNodesFunctionalitiesNoCondition" } ] }
Additional AWS ParallelCluster pcluster user policy when using Amazon FSx for Lustre
In case you need to create and manage a cluster with Amazon FSx for Lustre, the following additional policy is required.
If existing Amazon FSx file systems are the only file systems used in your cluster, you can scope down the example Amazon FSx policy statements to the specific file systems referenced in the SharedStorage section of the cluster configuration file.
AWS ParallelCluster image build pcluster user policy
Users that intend to create custom Amazon EC2 images with AWS ParallelCluster must have the following set of permissions.
AWS ParallelCluster user example policies for managing IAM resources
When using AWS ParallelCluster to create clusters or custom AMIs, IAM policies must be provided that contain permissions to grant the required set of permissions to AWS ParallelCluster components. These IAM resources can be either automatically created by AWS ParallelCluster or be provided as input when creating a cluster or a custom image.
You can use the following modes to provide the AWS ParallelCluster user with the permissions required to access IAM resources by using additional IAM policies in the configuration.
Privileged IAM access mode
With this mode, AWS ParallelCluster automatically creates all necessary IAM resources. These IAM policies are scoped down to enable access to cluster resources only.
To enable Privileged IAM access mode, add the following policy to the user role.
If you configure HeadNode / Iam / AdditionalPolicies or Scheduling / SlurmQueues / Iam / AdditionalPolicies parameters, you must provide the AWS ParallelCluster user with permission to attach and detach role policies for each additional policy as shown in the following policy. Add the additional policy ARNs to the condition for attaching and detaching role policies.
This mode enables the user to have IAM Administrator privileges in the AWS account
Restricted IAM access mode
When no additional IAM policies are granted to the user, IAM roles required by clusters or custom image builds need to be manually created by an administrator and passed as part of the cluster configuration.
When creating a cluster the following parameters are required:
When creating a cluster with login nodes, the following parameter is also required:
-
LoginNodes / Pools / Iam / InstanceRole | InstanceProfile
When building a custom image the following parameters are required:
-
Build / Iam / InstanceRole | InstanceProfile
The IAM roles passed as part of the above listed parameters must be created on the
/parallelcluster/ path prefix. If this isn't possible, the user policy needs to be
updated to grant iam:PassRole permission on the specific custom roles, as in the following
example.
{ "Condition": { "StringEqualsIfExists": { "iam:PassedToService": [ "ecs-tasks.amazonaws.com", "lambda.amazonaws.com", "ec2.amazonaws.com", "spotfleet.amazonaws.com", "batch.amazonaws.com", "codebuild.amazonaws.com" ] } }, "Action": [ "iam:PassRole" ], "Resource": [<list all custom IAM roles>], "Effect": "Allow", "Sid": "IamPassRole" }
Currently this mode does not allow the management of AWS Batch clusters because not all IAM roles can be passed in the cluster configuration.
PermissionsBoundary mode
This mode delegates to AWS ParallelCluster the creation of IAM roles that are bound to the configured IAM permissions boundary. For more information on IAM permissions boundaries, see Permissions boundaries for IAM entities in the IAM User Guide.
The following policy needs to be added to the user role.
In the policy, replace <permissions-boundary-arn> with the IAM policy ARN to be enforced
as permissions boundary.
If you configure the HeadNode / Iam / AdditionalPolicies or Scheduling / SlurmQueues / Iam / AdditionalPolicies parameters, you must grant the user permission to attach and detach role policies for each additional policy as shown in the following policy. Add the additional policy ARNs to the condition for attaching and detaching role policies.
When this mode is enabled, you must specify the permissions boundary ARN in the Iam / PermissionsBoundary configuration parameter when creating or updating a cluster and in the Build / Iam / PermissionBoundary parameter when building a custom image.
AWS ParallelCluster configuration parameters to manage IAM permissions
AWS ParallelCluster exposes a series of configuration options to customize and manage the IAM permissions and roles that are used in a cluster or during the custom AMI creation process.
Cluster configuration
Topics
Head node IAM role
HeadNode / Iam / InstanceRole | InstanceProfile
With this option, you override the default IAM role that's assigned to the head node of the cluster. For additional details, please refer to the InstanceProfile reference.
Here is the minimal set of policies to be used as part of this role when the scheduler is Slurm:
-
arn:aws:iam::aws:policy/CloudWatchAgentServerPolicymanaged IAM policy. For more information, see Create IAM roles and users for use with the CloudWatch agent in the Amazon CloudWatch User Guide. -
arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCoremanaged IAM policy. For more information, see AWS managed policies for AWS Systems Manager in the AWS Systems Manager User Guide. -
Additional IAM policy:
Note that in case Scheduling / SlurmQueues / Iam
/ InstanceRole is used to override the
compute IAM role, the head node policy reported above needs to include such role in the Resource
section of the iam:PassRole permission.
Depending on your cluster configuration, add the following permissions to the head node role:
-
Grant
secretsmanager:GetSecretValueon the secrets that you specify in MungeKeySecretArn, PasswordSecretArn, and Database / PasswordSecretArn. IfPasswordSecretArnreferences an Systems Manager parameter, grantssm:GetParameteron that parameter instead. -
Grant
ec2:RunInstances,ec2:CreateFleet, andresource-groups:ListGroupResourceson the capacity reservations and capacity reservation resource groups that you specify in your cluster configuration.
AWS ParallelCluster version 3.15.1 and earlier supports AWS Batch as a scheduler. If you use AWS Batch, attach the following minimal set of policies to this role:
-
arn:aws:iam::aws:policy/CloudWatchAgentServerPolicymanaged IAM policy. For more information, see Create IAM roles and users for use with the CloudWatch agent in the Amazon CloudWatch User Guide. -
arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCoremanaged IAM policy. For more information, see AWS managed policies for AWS Systems Manager in the AWS Systems Manager User Guide. -
Additional IAM policy:
Amazon S3 access
HeadNode / Iam / S3Access or Scheduling / SlurmQueues / S3Access
In these configuration sections, you can customize the Amazon S3 access by granting additional Amazon S3 policies to the IAM roles associated with the head node or compute nodes of the cluster when such roles are created by AWS ParallelCluster. For more information, see the reference documentation for each of the configuration parameter.
This parameter can be only used when the user is configured with Privileged IAM access mode or PermissionsBoundary mode.
Additional IAM policies
HeadNode / Iam / AdditionalIamPolicies or SlurmQueues / Iam / AdditionalIamPolicies or Pools / Iam / AdditionalIamPolicies
Use this option to attach additional managed IAM policies to the IAM roles associated with the head node, compute nodes, or login nodes of the cluster when such roles are created by AWS ParallelCluster.
To use this option, make sure the AWS ParallelCluster user is granted
iam:AttachRolePolicy and iam:DetachRolePolicy permissions for the IAM policies that need to be attached.
AWS Lambda functions role
Iam / Roles / LambdaFunctionsRole
This option overrides the role attached to all AWS Lambda functions that are used during the cluster creation process. AWS Lambda needs to be configured as the principal allowed to assume the role.
If DeploymentSettings /
LambdaFunctionsVpcConfig is set, the LambdaFunctionsRole must include the AWS Lambda role permission
to set the VPC configuration.
Here is the minimal set of policies to be used as part of this role:
Compute nodes IAM role
Scheduling / SlurmQueues / Iam / InstanceRole | InstanceProfile
This option allows you to override the IAM role that is assigned to the compute nodes of the cluster. For more information, see InstanceProfile.
Here is the minimal set of policies to be used as part of this role:
-
arn:aws:iam::aws:policy/CloudWatchAgentServerPolicymanaged IAM policy. For more information, see Create IAM roles and users for use with the CloudWatch agent in the Amazon CloudWatch User Guide. -
arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCoremanaged IAM policy. For more information, see AWS managed policies for AWS Systems Manager in the AWS Systems Manager User Guide. -
Additional IAM policy:
Login nodes IAM role
LoginNodes / Pools / Iam / InstanceRole | InstanceProfile
Use this option to override the IAM role that AWS ParallelCluster assigns to the login nodes of your cluster. For more information, see InstanceProfile.
Attach the following minimal set of policies to this role:
-
Attach the
arn:aws:iam::aws:policy/CloudWatchAgentServerPolicymanaged IAM policy. For more information, see Create IAM roles and users for use with the CloudWatch agent in the Amazon CloudWatch User Guide. -
Attach the
arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCoremanaged IAM policy. For more information, see AWS managed policies for AWS Systems Manager in the AWS Systems Manager User Guide. -
Attach an additional IAM policy with the permissions that login nodes require. The following policy grants login nodes the permissions to read objects from Amazon S3, describe the cluster CloudFormation stack, read and write items in the AWS ParallelCluster DynamoDB tables, and complete Auto Scaling lifecycle actions:
{ "Version": "2012-10-17", "Statement": [ { "Action": "ec2:DescribeInstanceAttribute", "Resource": "*", "Effect": "Allow" }, { "Action": "s3:GetObject", "Resource": [ "arn:aws:s3:::us-east-1-aws-parallelcluster/*", "arn:aws:s3:::dcv-license.us-east-1/*" ], "Effect": "Allow" }, { "Action": "autoscaling:CompleteLifecycleAction", "Resource": "arn:aws:autoscaling:us-east-1:<AWS ACCOUNT ID>:autoScalingGroup:*:autoScalingGroupName/*", "Effect": "Allow" }, { "Action": [ "cloudformation:DescribeStackResource", "cloudformation:DescribeStacks" ], "Resource": "arn:aws:cloudformation:us-east-1:<AWS ACCOUNT ID>:stack/*/*", "Effect": "Allow" }, { "Action": [ "dynamodb:UpdateItem", "dynamodb:PutItem", "dynamodb:GetItem" ], "Resource": "arn:aws:dynamodb:us-east-1:<AWS ACCOUNT ID>:table/parallelcluster-*", "Effect": "Allow" } ] }
Permissions boundary
This parameter forces AWS ParallelCluster to attach the given IAM policy as a PermissionsBoundary to all IAM
roles that are created as part of a cluster deployment.
See PermissionsBoundary mode for the list of policies required by the user when this setting is defined.
Custom Image configuration
Topics
Instance role for EC2 Image Builder
Build / Iam / InstanceRole | InstanceProfile
With this option you override the IAM role that is assigned to the Amazon EC2 instance launched by EC2 Image Builder to create a custom AMI.
Here is the minimal set of policies to be used as part of this role:
-
arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCoremanaged IAM policy. For more information, see AWS managed policies for AWS Systems Manager in the AWS Systems Manager User Guide. -
arn:aws:iam::aws:policy/EC2InstanceProfileForImageBuildermanaged IAM policy. For more information, seeEC2InstanceProfileForImageBuilderpolicy in the Image Builder User Guide. -
Additional IAM policy:
AWS Lambda cleanup role
Build / Iam / CleanupLambdaRole
This option overrides the role attached to all AWS Lambda functions that are used during the custom image build process. AWS Lambda needs to be configured as the principal allowed to assume the role.
If DeploymentSettings /
LambdaFunctionsVpcConfig is set, the CleanupLambdaRole must include the AWS Lambda role permission
to set the VPC configuration.
Here is the minimal set of policies to be used as part of this role:
-
arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRolemanaged IAM policy. For more information, see AWS managed policies for Lambda features in the AWS Lambda Developer Guide. -
Additional IAM policy:
Additional IAM policies
Build / Iam / AdditionalIamPolicies
You use this option to attach additional managed IAM policies to the role associated with the Amazon EC2 instance used by EC2 Image Builder to produce the custom AMI.
To use this option, make sure the AWS ParallelClusteruser is granted
iam:AttachRolePolicy and iam:DetachRolePolicy permissions for the IAM policies that need to be attached.
Permissions boundary
Build / Iam / PermissionsBoundary
This parameter forces AWS ParallelCluster to attach the given IAM policy as a PermissionsBoundary
to all IAM roles that are created as part of custom AMI build.
See PermissionsBoundary mode for the list of policies required to use such functionality.