@@ -726,11 +726,18 @@ aws iam create-policy --policy-name circleci-vm --policy-document file://<POLICY
726
726
"arn:aws:ec2:*:*:launch-template/*",
727
727
"arn:aws:ec2:*:*:network-interface/*",
728
728
"arn:aws:ec2:*:*:placement-group/*",
729
- "arn:aws:ec2:*:*:subnet/*",
730
729
"arn:aws:ec2:*:*:security-group/<SECURITY_GROUP_ID>",
731
730
"arn:aws:ec2:*:*:volume/*"
732
731
]
733
732
},
733
+ {
734
+ "Action": "ec2:RunInstances",
735
+ "Effect": "Allow",
736
+ "Resource": [
737
+ "arn:aws:ec2:*:*:subnet/<SUBNET_ID_1>",
738
+ "arn:aws:ec2:*:*:subnet/<SUBNET_ID_2>"
739
+ ]
740
+ },
734
741
{
735
742
"Action": "ec2:RunInstances",
736
743
"Effect": "Allow",
@@ -756,7 +763,7 @@ aws iam create-policy --policy-name circleci-vm --policy-document file://<POLICY
756
763
"Resource": "arn:aws:ec2:*:*:*/*",
757
764
"Condition": {
758
765
"StringEquals": {
759
- "ec2:CreateAction" : "RunInstances"
766
+ "ec2:CreateAction": "RunInstances"
760
767
}
761
768
}
762
769
},
@@ -783,10 +790,13 @@ aws iam create-policy --policy-name circleci-vm --policy-document file://<POLICY
783
790
"ec2:TerminateInstances"
784
791
],
785
792
"Effect": "Allow",
786
- "Resource": "arn:aws:ec2:*:*:subnet /*",
793
+ "Resource": "arn:aws:ec2:*:*:instance /*",
787
794
"Condition": {
788
- "StringEquals": {
789
- "ec2:Vpc": "<VPC_ID>"
795
+ "StringLike": {
796
+ "ec2:Subnet": [
797
+ "arn:aws:ec2:*:*:subnet/<SUBNET_ID_1>",
798
+ "arn:aws:ec2:*:*:subnet/<SUBNET_ID_2>"
799
+ ]
790
800
}
791
801
}
792
802
}
@@ -858,11 +868,18 @@ Create a `policy.json` file with the following content. You should fill in the I
858
868
"arn:aws:ec2:*:*:launch-template/*",
859
869
"arn:aws:ec2:*:*:network-interface/*",
860
870
"arn:aws:ec2:*:*:placement-group/*",
861
- "arn:aws:ec2:*:*:subnet/*",
862
871
"arn:aws:ec2:*:*:security-group/<SECURITY_GROUP_ID>"
863
872
"arn:aws:ec2:*:*:volume/*"
864
873
]
865
874
},
875
+ {
876
+ "Action": "ec2:RunInstances",
877
+ "Effect": "Allow",
878
+ "Resource": [
879
+ "arn:aws:ec2:*:*:subnet/<SUBNET_ID_1>",
880
+ "arn:aws:ec2:*:*:subnet/<SUBNET_ID_2>"
881
+ ]
882
+ },
866
883
{
867
884
"Action": "ec2:RunInstances",
868
885
"Effect": "Allow",
@@ -915,10 +932,13 @@ Create a `policy.json` file with the following content. You should fill in the I
915
932
"ec2:TerminateInstances"
916
933
],
917
934
"Effect": "Allow",
918
- "Resource": "arn:aws:ec2:*:*:subnet /*",
935
+ "Resource": "arn:aws:ec2:*:*:instance /*",
919
936
"Condition": {
920
- "StringEquals": {
921
- "ec2:Vpc": "<VPC_ID>"
937
+ "StringLike": {
938
+ "ec2:Subnet": [
939
+ "arn:aws:ec2:*:*:subnet/<SUBNET_ID_1>",
940
+ "arn:aws:ec2:*:*:subnet/<SUBNET_ID_2>"
941
+ ]
922
942
}
923
943
}
924
944
}
0 commit comments