@@ -66,20 +66,14 @@ Outputs:
66
66
ParallelClusterLogRetrievalPolicy :
67
67
Value : !Ref ParallelClusterLogRetrievalPolicy
68
68
69
- ParallelClusterDescribeImageManagedPolicy :
70
- Value : !Ref ParallelClusterDescribeImageManagedPolicy
69
+ ParallelClusterImageManagedPolicy :
70
+ Value : !Ref ParallelClusterImageManagedPolicy
71
71
72
- ParallelClusterListImagesManagedPolicy :
73
- Value : !Ref ParallelClusterListImagesManagedPolicy
72
+ ParallelClusterClusterPolicy1 :
73
+ Value : !Ref ParallelClusterClusterPolicy1
74
74
75
- ParallelClusterDeleteImageManagedPolicy :
76
- Value : !Ref ParallelClusterDeleteImageManagedPolicy
77
-
78
- ParallelClusterBuildImageManagedPolicy :
79
- Value : !Ref ParallelClusterBuildImageManagedPolicy
80
-
81
- ParallelClusterClusterPolicy :
82
- Value : !Ref ParallelClusterClusterPolicy
75
+ ParallelClusterClusterPolicy2 :
76
+ Value : !Ref ParallelClusterClusterPolicy2
83
77
84
78
FSxS3AccessPolicy :
85
79
Condition : EnableFSxS3AccessCondition
@@ -210,15 +204,13 @@ Resources:
210
204
- !Sub arn:${AWS::Partition}:iam::aws:policy/AWSXRayDaemonWriteAccess
211
205
- !Sub arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
212
206
# Required to run ParallelCluster functionalities
213
- - !Ref ParallelClusterClusterPolicy
207
+ - !Ref ParallelClusterClusterPolicy1
208
+ - !Ref ParallelClusterClusterPolicy2
214
209
- !If
215
210
- EnableBatchAccessCondition
216
211
- !Ref ParallelClusterClusterPolicyBatch
217
212
- !Ref AWS::NoValue
218
- - !Ref ParallelClusterBuildImageManagedPolicy
219
- - !Ref ParallelClusterDeleteImageManagedPolicy
220
- - !Ref ParallelClusterListImagesManagedPolicy
221
- - !Ref ParallelClusterDescribeImageManagedPolicy
213
+ - !Ref ParallelClusterImageManagedPolicy
222
214
- !Ref ParallelClusterLogRetrievalPolicy
223
215
224
216
# ## CLUSTER ACTIONS POLICIES
@@ -336,11 +328,11 @@ Resources:
336
328
Roles :
337
329
- !Ref ParallelClusterLambdaRole
338
330
339
- ParallelClusterClusterPolicy :
331
+ ParallelClusterClusterPolicy1 :
340
332
Type : AWS::IAM::ManagedPolicy
341
333
Properties :
342
334
ManagedPolicyName : !Sub
343
- - ${IAMRoleAndPolicyPrefix}ParallelClusterClusterPolicy -${StackIdSuffix}
335
+ - ${IAMRoleAndPolicyPrefix}ParallelClusterClusterPolicy1 -${StackIdSuffix}
344
336
- { StackIdSuffix: !Select [ 0, !Split [ '-', !Select [ 2, !Split [ '/', !Ref 'AWS::StackId' ] ] ] ] }
345
337
PolicyDocument :
346
338
Version : ' 2012-10-17'
@@ -470,6 +462,16 @@ Resources:
470
462
aws:RequestedRegion :
471
463
- !Ref Region
472
464
Sid : CloudWatch
465
+
466
+ ParallelClusterClusterPolicy2 :
467
+ Type : AWS::IAM::ManagedPolicy
468
+ Properties :
469
+ ManagedPolicyName : !Sub
470
+ - ${IAMRoleAndPolicyPrefix}ParallelClusterClusterPolicy2-${StackIdSuffix}
471
+ - { StackIdSuffix: !Select [ 0, !Split [ '-', !Select [ 2, !Split [ '/', !Ref 'AWS::StackId' ] ] ] ] }
472
+ PolicyDocument :
473
+ Version : ' 2012-10-17'
474
+ Statement :
473
475
- Action :
474
476
- iam:GetRole
475
477
- iam:GetRolePolicy
@@ -624,24 +626,24 @@ Resources:
624
626
625
627
# ### IMAGE ACTIONS POLICIES
626
628
627
- ParallelClusterBuildImageManagedPolicy :
629
+ ParallelClusterImageManagedPolicy :
628
630
Type : AWS::IAM::ManagedPolicy
629
631
Properties :
630
632
ManagedPolicyName : !Sub
631
- - ${IAMRoleAndPolicyPrefix}ParallelClusterBuildImageManagedPolicy -${StackIdSuffix}
633
+ - ${IAMRoleAndPolicyPrefix}ParallelClusterImageManagedPolicy -${StackIdSuffix}
632
634
- { StackIdSuffix: !Select [ 0, !Split [ '-', !Select [ 2, !Split [ '/', !Ref 'AWS::StackId' ] ] ] ] }
633
- Description : Managed policy to execute pcluster build-image command without IAM permission
635
+ Description : Managed policy to execute pcluster build-image, delete-image, list-images and describe-image commands
634
636
PolicyDocument :
635
637
Version : ' 2012-10-17'
636
638
Statement :
637
- - Sid : EC2
639
+ - Sid : EC2BuildImage
638
640
Effect : Allow
639
641
Action :
640
642
- ec2:DescribeImages
641
643
- ec2:DescribeInstanceTypeOfferings
642
644
- ec2:DescribeInstanceTypes
643
645
Resource : ' *'
644
- - Sid : IAM
646
+ - Sid : IAMBuildImage
645
647
Effect : Allow
646
648
Action :
647
649
- iam:CreateInstanceProfile
@@ -653,7 +655,7 @@ Resources:
653
655
- !Sub ' arn:${AWS::Partition}:iam::${AWS::AccountId}:instance-profile/parallelcluster/*'
654
656
- !Sub ' arn:${AWS::Partition}:iam::${AWS::AccountId}:instance-profile/ParallelClusterImage*'
655
657
- !Sub ' arn:${AWS::Partition}:iam::${AWS::AccountId}:role/parallelcluster/*'
656
- - Sid : IAMPassRole
658
+ - Sid : IAMPassRoleBuildImage
657
659
Effect : Allow
658
660
Action :
659
661
- iam:PassRole
@@ -666,22 +668,22 @@ Resources:
666
668
- lambda.amazonaws.com
667
669
- ec2.amazonaws.com
668
670
- ec2.amazonaws.com.cn
669
- - Sid : CloudWatch
671
+ - Sid : CloudWatchBuildImage
670
672
Effect : Allow
671
673
Action :
672
674
- logs:CreateLogGroup
673
675
- logs:TagResource
674
676
- logs:UntagResource
675
677
Resource :
676
678
- !Sub ' arn:${AWS::Partition}:logs:${Region}:${AWS::AccountId}:log-group:/aws/lambda/ParallelClusterImage-*'
677
- - Sid : CloudFormation
679
+ - Sid : CloudFormationBuildImage
678
680
Effect : Allow
679
681
Action :
680
682
- cloudformation:DescribeStacks
681
683
- cloudformation:CreateStack
682
684
Resource :
683
685
- !Sub ' arn:${AWS::Partition}:cloudformation:${Region}:${AWS::AccountId}:stack/*'
684
- - Sid : Lambda
686
+ - Sid : LambdaBuildImage
685
687
Effect : Allow
686
688
Action :
687
689
- lambda:CreateFunction
@@ -690,12 +692,12 @@ Resources:
690
692
- lambda:AddPermission
691
693
Resource :
692
694
- !Sub ' arn:${AWS::Partition}:lambda:${Region}:${AWS::AccountId}:function:ParallelClusterImage-*'
693
- - Sid : ImageBuilderGet
695
+ - Sid : ImageBuilderGetBuildImage
694
696
Effect : Allow
695
697
Action :
696
698
- imagebuilder:Get*
697
699
Resource : ' *'
698
- - Sid : ImageBuilder
700
+ - Sid : ImageBuilderBuildImage
699
701
Effect : Allow
700
702
Action :
701
703
- imagebuilder:CreateImage
@@ -710,14 +712,14 @@ Resources:
710
712
- !Sub ' arn:${AWS::Partition}:imagebuilder:${Region}:${AWS::AccountId}:component/parallelclusterimage-*'
711
713
- !Sub ' arn:${AWS::Partition}:imagebuilder:${Region}:${AWS::AccountId}:distribution-configuration/parallelclusterimage-*'
712
714
- !Sub ' arn:${AWS::Partition}:imagebuilder:${Region}:${AWS::AccountId}:infrastructure-configuration/parallelclusterimage-*'
713
- - Sid : S3Bucket
715
+ - Sid : S3BucketBuildImage
714
716
Effect : Allow
715
717
Action :
716
718
- s3:CreateBucket
717
719
- s3:ListBucket
718
720
Resource :
719
721
- !Sub ' arn:${AWS::Partition}:s3:::parallelcluster-*'
720
- - Sid : SNS
722
+ - Sid : SNSBuildImage
721
723
Effect : Allow
722
724
Action :
723
725
- sns:GetTopicAttributes
@@ -727,14 +729,15 @@ Resources:
727
729
- sns:Publish
728
730
Resource :
729
731
- !Sub ' arn:${AWS::Partition}:sns:${Region}:${AWS::AccountId}:ParallelClusterImage-*'
730
- - Sid : S3Objects
732
+ - Sid : S3ObjectsBuildImage
731
733
Effect : Allow
732
734
Action :
733
735
- s3:PutObject
734
736
- s3:GetObject
735
737
Resource :
736
738
- !Sub ' arn:${AWS::Partition}:s3:::parallelcluster-*/*'
737
- - Action :
739
+ - Sid : IAMSLRBuildImage
740
+ Action :
738
741
- iam:CreateServiceLinkedRole
739
742
Resource :
740
743
- !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:role/aws-service-role/imagebuilder.amazonaws.com/AWSServiceRoleForImageBuilder
@@ -743,32 +746,21 @@ Resources:
743
746
StringLike :
744
747
iam:AWSServiceName :
745
748
- imagebuilder.amazonaws.com
746
-
747
- ParallelClusterDeleteImageManagedPolicy :
748
- Type : AWS::IAM::ManagedPolicy
749
- Properties :
750
- ManagedPolicyName : !Sub
751
- - ${IAMRoleAndPolicyPrefix}ParallelClusterDeleteImageManagedPolicy-${StackIdSuffix}
752
- - { StackIdSuffix: !Select [ 0, !Split [ '-', !Select [ 2, !Split [ '/', !Ref 'AWS::StackId' ] ] ] ] }
753
- Description : Managed policy to execute pcluster delete-image command without IAM permission
754
- PolicyDocument :
755
- Version : ' 2012-10-17'
756
- Statement :
757
- - Sid : EC2
749
+ - Sid : EC2DeleteImage
758
750
Effect : Allow
759
751
Action :
760
752
- ec2:DeregisterImage
761
753
- ec2:DescribeImages
762
754
- ec2:DeleteSnapshot
763
755
Resource : ' *'
764
- - Sid : IAM
756
+ - Sid : IAMDeleteImage
765
757
Effect : Allow
766
758
Action :
767
759
- iam:RemoveRoleFromInstanceProfile
768
760
Resource :
769
761
- !Sub ' arn:${AWS::Partition}:iam::${AWS::AccountId}:instance-profile/parallelcluster/*'
770
762
- !Sub ' arn:${AWS::Partition}:iam::${AWS::AccountId}:role/parallelcluster/*'
771
- - Sid : ImageBuilder
763
+ - Sid : ImageBuilderDeleteImage
772
764
Effect : Allow
773
765
Action :
774
766
- imagebuilder:DeleteImage
@@ -784,37 +776,37 @@ Resources:
784
776
- !Sub ' arn:${AWS::Partition}:imagebuilder:${Region}:${AWS::AccountId}:component/parallelclusterimage-*'
785
777
- !Sub ' arn:${AWS::Partition}:imagebuilder:${Region}:${AWS::AccountId}:distribution-configuration/parallelclusterimage-*'
786
778
- !Sub ' arn:${AWS::Partition}:imagebuilder:${Region}:${AWS::AccountId}:infrastructure-configuration/parallelclusterimage-*'
787
- - Sid : CloudFormation
779
+ - Sid : CloudFormationDeleteImage
788
780
Effect : Allow
789
781
Action :
790
782
- cloudformation:DescribeStacks
791
783
- cloudformation:DeleteStack
792
784
Resource :
793
785
- !Sub ' arn:${AWS::Partition}:cloudformation:${Region}:${AWS::AccountId}:stack/*'
794
- - Sid : Lambda
786
+ - Sid : LambdaDeleteImage
795
787
Effect : Allow
796
788
Action :
797
789
- lambda:RemovePermission
798
790
- lambda:DeleteFunction
799
791
- lambda:AddPermission
800
792
Resource :
801
793
- !Sub ' arn:${AWS::Partition}:lambda:${Region}:${AWS::AccountId}:function:ParallelClusterImage-*'
802
- - Sid : SNS
794
+ - Sid : SNSDeleteImage
803
795
Effect : Allow
804
796
Action :
805
797
- SNS:DeleteTopic
806
798
- SNS:Unsubscribe
807
799
- SNS:GetTopicAttributes
808
800
Resource :
809
801
- !Sub ' arn:${AWS::Partition}:sns:${Region}:${AWS::AccountId}:ParallelClusterImage-*'
810
- - Sid : S3Bucket
802
+ - Sid : S3BucketDeleteImage
811
803
Effect : Allow
812
804
Action :
813
805
- s3:ListBucket
814
806
- s3:ListBucketVersions
815
807
Resource :
816
808
- !Sub ' arn:${AWS::Partition}:s3:::parallelcluster-*'
817
- - Sid : S3Objects
809
+ - Sid : S3ObjectsDeleteImage
818
810
Effect : Allow
819
811
Action :
820
812
- s3:PutObject
@@ -824,58 +816,25 @@ Resources:
824
816
- s3:DeleteObjectVersion
825
817
Resource :
826
818
- !Sub ' arn:${AWS::Partition}:s3:::parallelcluster-*/*'
827
- - Sid : CloudWatch
819
+ - Sid : CloudWatchDeleteImage
828
820
Effect : Allow
829
821
Action :
830
822
- logs:DeleteLogGroup
831
823
Resource :
832
824
- !Sub ' arn:${AWS::Partition}:logs:${Region}:${AWS::AccountId}:log-group:/aws/imagebuilder/ParallelClusterImage-*'
833
825
- !Sub ' arn:${AWS::Partition}:logs:${Region}:${AWS::AccountId}:log-group:/aws/lambda/ParallelClusterImage-*'
834
-
835
- ParallelClusterListImagesManagedPolicy :
836
- Type : AWS::IAM::ManagedPolicy
837
- Properties :
838
- ManagedPolicyName : !Sub
839
- - ${IAMRoleAndPolicyPrefix}ParallelClusterListImagesManagedPolicy-${StackIdSuffix}
840
- - { StackIdSuffix: !Select [ 0, !Split [ '-', !Select [ 2, !Split [ '/', !Ref 'AWS::StackId' ] ] ] ] }
841
- Description : Managed policy to execute pcluster list-images command
842
- PolicyDocument :
843
- Version : ' 2012-10-17'
844
- Statement :
845
- - Sid : EC2
826
+ - Sid : EC2ListImages
846
827
Effect : Allow
847
828
Action :
848
829
- ec2:DescribeImages
849
830
Resource : ' *'
850
- - Sid : CloudFormation
831
+ - Sid : CloudFormationListImages
851
832
Effect : Allow
852
833
Action :
853
834
- cloudformation:DescribeStacks
854
835
Resource :
855
836
- ' *'
856
837
857
- ParallelClusterDescribeImageManagedPolicy :
858
- Type : AWS::IAM::ManagedPolicy
859
- Properties :
860
- ManagedPolicyName : !Sub
861
- - ${IAMRoleAndPolicyPrefix}ParallelClusterDescribeImageManagedPolicy-${StackIdSuffix}
862
- - { StackIdSuffix: !Select [ 0, !Split [ '-', !Select [ 2, !Split [ '/', !Ref 'AWS::StackId' ] ] ] ] }
863
- Description : Managed policy to execute pcluster describe-image command
864
- PolicyDocument :
865
- Version : ' 2012-10-17'
866
- Statement :
867
- - Sid : EC2
868
- Effect : Allow
869
- Action :
870
- - ec2:DescribeImages
871
- Resource : ' *'
872
- - Sid : CloudFormation
873
- Effect : Allow
874
- Action :
875
- - cloudformation:DescribeStacks
876
- Resource :
877
- - !Sub ' arn:${AWS::Partition}:cloudformation:${Region}:${AWS::AccountId}:stack/*'
878
-
879
838
# ## LOG COMMANDS
880
839
881
840
ParallelClusterLogRetrievalPolicy :
0 commit comments