Files
Triple-C/aws/policies/environment-admin-compute.json
T
shadowdaoandClaude Opus 5.5 e6fbf4e133 fix(aws): pin, type-limit and fence per-user EC2 capacity permissions
Review fix round 1 for the phase 7 admin compute file and boundary:
- Auto Scaling groups: create needs autoscaling:LaunchTemplateVersionSpecified
  (update BoolIfExists), no target groups / load balancers, supported
  instance types; CreateOrUpdateTags only on already-tagged groups.
  ModifyLaunchTemplate dropped (the default version never moves).
- RunInstances: instance and volume need the component request tag,
  the instance a supported type (the app's ec2_instance_spec table,
  pinned by a test); the security group must be the template's own and
  component-tagged, the image Amazon's and the template's.
- Boundary: the ECS agent only on the cluster its role's
  triple-c:cluster principal tag names (must be triple-c-*); Session
  Manager / ec2messages dropped (plan E4 amended).
- Evaluator learns Bool/BoolIfExists; the simulator sends the Boolean
  keys typed Boolean.
- README: instance types, pinning, -instance suffix is not an admin
  fence, RunInstances wording, still-open probes, IMDS/Docker note.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 13:17:54 -08:00

387 lines
9.4 KiB
JSON

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ManageTripleCCapacityProviders",
"Effect": "Allow",
"Action": [
"ecs:CreateCapacityProvider",
"ecs:UpdateCapacityProvider",
"ecs:DeleteCapacityProvider",
"ecs:PutClusterCapacityProviders",
"ecs:TagResource",
"ecs:UntagResource",
"ecs:ListTagsForResource"
],
"Resource": [
"arn:aws:ecs:*:*:capacity-provider/triple-c-*"
]
},
{
"Sid": "CreateTaggedLaunchTemplates",
"Effect": "Allow",
"Action": [
"ec2:CreateLaunchTemplate"
],
"Resource": [
"arn:aws:ec2:*:*:launch-template/*"
],
"Condition": {
"Null": {
"aws:RequestTag/triple-c:component": "false"
}
}
},
{
"Sid": "TagComputeAtCreate",
"Effect": "Allow",
"Action": [
"ec2:CreateTags"
],
"Resource": [
"arn:aws:ec2:*:*:launch-template/*",
"arn:aws:ec2:*:*:instance/*",
"arn:aws:ec2:*:*:volume/*",
"arn:aws:ec2:*:*:network-interface/*"
],
"Condition": {
"StringEquals": {
"ec2:CreateAction": [
"CreateLaunchTemplate",
"RunInstances"
]
}
}
},
{
"Sid": "ManageAndUseTripleCLaunchTemplates",
"Effect": "Allow",
"Action": [
"ec2:CreateLaunchTemplateVersion",
"ec2:DeleteLaunchTemplate",
"ec2:CreateTags",
"ec2:DeleteTags",
"ec2:RunInstances"
],
"Resource": [
"arn:aws:ec2:*:*:launch-template/*"
],
"Condition": {
"Null": {
"aws:ResourceTag/triple-c:component": "false"
}
}
},
{
"Sid": "LaunchSupportedInstances",
"Effect": "Allow",
"Action": [
"ec2:RunInstances"
],
"Resource": [
"arn:aws:ec2:*:*:instance/*",
"arn:aws:ec2:*:*:volume/*"
],
"Condition": {
"Null": {
"aws:RequestTag/triple-c:component": "false"
},
"ArnLike": {
"ec2:LaunchTemplate": "arn:aws:ec2:*:*:launch-template/*"
},
"StringEqualsIfExists": {
"ec2:InstanceType": [
"m7i.large",
"m7i.xlarge",
"m7i.2xlarge",
"m7i.4xlarge",
"m7g.large",
"m7g.xlarge",
"m7g.2xlarge",
"m7g.4xlarge",
"c7i.large",
"c7i.xlarge",
"c7i.2xlarge",
"c7i.4xlarge",
"c7g.large",
"c7g.xlarge",
"c7g.2xlarge",
"c7g.4xlarge",
"r7i.large",
"r7i.xlarge",
"r7i.2xlarge",
"r7i.4xlarge",
"r7g.large",
"r7g.xlarge",
"r7g.2xlarge",
"r7g.4xlarge",
"t3.large",
"t3.xlarge",
"t3.2xlarge",
"t4g.large",
"t4g.xlarge",
"t4g.2xlarge"
]
}
}
},
{
"Sid": "LaunchIntoSubnets",
"Effect": "Allow",
"Action": [
"ec2:RunInstances"
],
"Resource": [
"arn:aws:ec2:*:*:network-interface/*",
"arn:aws:ec2:*:*:subnet/*"
],
"Condition": {
"ArnLike": {
"ec2:LaunchTemplate": "arn:aws:ec2:*:*:launch-template/*"
}
}
},
{
"Sid": "LaunchWithTripleCGroups",
"Effect": "Allow",
"Action": [
"ec2:RunInstances"
],
"Resource": [
"arn:aws:ec2:*:*:security-group/*"
],
"Condition": {
"ArnLike": {
"ec2:LaunchTemplate": "arn:aws:ec2:*:*:launch-template/*"
},
"Bool": {
"ec2:IsLaunchTemplateResource": "true"
},
"Null": {
"aws:ResourceTag/triple-c:component": "false"
}
}
},
{
"Sid": "LaunchAmazonImages",
"Effect": "Allow",
"Action": [
"ec2:RunInstances"
],
"Resource": [
"arn:aws:ec2:*::image/*"
],
"Condition": {
"StringEquals": {
"ec2:Owner": "amazon"
},
"ArnLike": {
"ec2:LaunchTemplate": "arn:aws:ec2:*:*:launch-template/*"
},
"Bool": {
"ec2:IsLaunchTemplateResource": "true"
}
}
},
{
"Sid": "CreatePinnedGroups",
"Effect": "Allow",
"Action": [
"autoscaling:CreateAutoScalingGroup"
],
"Resource": [
"arn:aws:autoscaling:*:*:autoScalingGroup:*:autoScalingGroupName/triple-c-*"
],
"Condition": {
"Null": {
"aws:RequestTag/triple-c:component": "false",
"autoscaling:TargetGroupARNs": "true",
"autoscaling:LoadBalancerNames": "true"
},
"Bool": {
"autoscaling:LaunchTemplateVersionSpecified": "true"
},
"ForAllValues:StringEquals": {
"autoscaling:InstanceTypes": [
"m7i.large",
"m7i.xlarge",
"m7i.2xlarge",
"m7i.4xlarge",
"m7g.large",
"m7g.xlarge",
"m7g.2xlarge",
"m7g.4xlarge",
"c7i.large",
"c7i.xlarge",
"c7i.2xlarge",
"c7i.4xlarge",
"c7g.large",
"c7g.xlarge",
"c7g.2xlarge",
"c7g.4xlarge",
"r7i.large",
"r7i.xlarge",
"r7i.2xlarge",
"r7i.4xlarge",
"r7g.large",
"r7g.xlarge",
"r7g.2xlarge",
"r7g.4xlarge",
"t3.large",
"t3.xlarge",
"t3.2xlarge",
"t4g.large",
"t4g.xlarge",
"t4g.2xlarge"
]
}
}
},
{
"Sid": "UpdatePinnedGroups",
"Effect": "Allow",
"Action": [
"autoscaling:UpdateAutoScalingGroup"
],
"Resource": [
"arn:aws:autoscaling:*:*:autoScalingGroup:*:autoScalingGroupName/triple-c-*"
],
"Condition": {
"Null": {
"aws:ResourceTag/triple-c:component": "false",
"autoscaling:TargetGroupARNs": "true",
"autoscaling:LoadBalancerNames": "true"
},
"BoolIfExists": {
"autoscaling:LaunchTemplateVersionSpecified": "true"
},
"ForAllValues:StringEquals": {
"autoscaling:InstanceTypes": [
"m7i.large",
"m7i.xlarge",
"m7i.2xlarge",
"m7i.4xlarge",
"m7g.large",
"m7g.xlarge",
"m7g.2xlarge",
"m7g.4xlarge",
"c7i.large",
"c7i.xlarge",
"c7i.2xlarge",
"c7i.4xlarge",
"c7g.large",
"c7g.xlarge",
"c7g.2xlarge",
"c7g.4xlarge",
"r7i.large",
"r7i.xlarge",
"r7i.2xlarge",
"r7i.4xlarge",
"r7g.large",
"r7g.xlarge",
"r7g.2xlarge",
"r7g.4xlarge",
"t3.large",
"t3.xlarge",
"t3.2xlarge",
"t4g.large",
"t4g.xlarge",
"t4g.2xlarge"
]
}
}
},
{
"Sid": "ManageTripleCAutoScalingGroups",
"Effect": "Allow",
"Action": [
"autoscaling:SetInstanceProtection",
"autoscaling:CreateOrUpdateTags",
"autoscaling:DeleteTags",
"autoscaling:DeleteAutoScalingGroup"
],
"Resource": [
"arn:aws:autoscaling:*:*:autoScalingGroup:*:autoScalingGroupName/triple-c-*"
],
"Condition": {
"Null": {
"aws:ResourceTag/triple-c:component": "false"
}
}
},
{
"Sid": "CreateComputeServiceLinkedRoles",
"Effect": "Allow",
"Action": [
"iam:CreateServiceLinkedRole"
],
"Resource": [
"arn:aws:iam::*:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling*",
"arn:aws:iam::*:role/aws-service-role/ecs.amazonaws.com/AWSServiceRoleForECS*"
],
"Condition": {
"StringEquals": {
"iam:AWSServiceName": [
"autoscaling.amazonaws.com",
"ecs.amazonaws.com"
]
}
}
},
{
"Sid": "ManageTripleCInstanceProfiles",
"Effect": "Allow",
"Action": [
"iam:CreateInstanceProfile",
"iam:DeleteInstanceProfile",
"iam:GetInstanceProfile",
"iam:AddRoleToInstanceProfile",
"iam:RemoveRoleFromInstanceProfile",
"iam:TagInstanceProfile",
"iam:UntagInstanceProfile",
"iam:ListInstanceProfileTags"
],
"Resource": [
"arn:aws:iam::*:instance-profile/triple-c-*"
]
},
{
"Sid": "PassInstanceRolesToEc2",
"Effect": "Allow",
"Action": [
"iam:PassRole"
],
"Resource": [
"arn:aws:iam::*:role/triple-c-*-instance"
],
"Condition": {
"StringEquals": {
"iam:PassedToService": "ec2.amazonaws.com"
}
}
},
{
"Sid": "ReadEcsOptimizedAmis",
"Effect": "Allow",
"Action": [
"ssm:GetParameter",
"ssm:GetParameters"
],
"Resource": [
"arn:aws:ssm:*::parameter/aws/service/ecs/optimized-ami/*"
]
},
{
"Sid": "ReadCompute",
"Effect": "Allow",
"Action": [
"ecs:DescribeCapacityProviders",
"autoscaling:Describe*"
],
"Resource": [
"*"
]
}
]
}