latest run 54 pass 0 fail 0 skipevidence →
HKB Operations: pages
HKB OperationsKnowledge space

Starred pages

Pages

Page directory · Labels · [ hides this

hkb-pipeline-cfn-network

CloudFormation service role for the hkb-vpc, hkb-image and hkb-network stacks. VPC, NAT instance, Elastic IP, Image Builder, schedules, Patch Manager; roles only as hkb-net-* under hkb-workload-boundary.

  • Lives in: Sandbox, Dev, Prod. Trusted by: cloudformation.amazonaws.com.
  • Boundary: hkb-network-boundary.
  • Reach: 102 named actions across 7 services (ec2, iam, imagebuilder, kms, logs, scheduler, ssm); 7 statements on all resources.
  • Source: baseline/hkb-baseline-network.yaml, resource NetworkCfnRole.

Trust policy

AssumeRolePolicyDocument:
  Version: "2012-10-17"
  Statement:
    - Effect: Allow
      Principal:
        Service: cloudformation.amazonaws.com
      Action: sts:AssumeRole
      Condition:
        StringEquals:
          aws:SourceAccount: !Ref AWS::AccountId

Permissions

Policies:
  - PolicyName: hkb-pipeline-cfn-network
    PolicyDocument:
      Version: "2012-10-17"
      Statement:
        # VPC, subnets, routes, gateways, security groups, the NAT instance and its address. EC2
        # IDs aren't known before creation, so the resource is "*"; SCP-10 still holds in Sandbox.
        - Sid: VpcAndInstances
          Effect: Allow
          Action:
            - ec2:Describe*
            - ec2:CreateTags
            - ec2:DeleteTags
            - ec2:*Vpc
            - ec2:ModifyVpcAttribute
            - ec2:*Subnet
            - ec2:ModifySubnetAttribute
            - ec2:*RouteTable
            - ec2:*Route
            - ec2:*InternetGateway
            - ec2:ModifyVpcBlockPublicAccessOptions
            - ec2:*VpcBlockPublicAccessExclusion
            - ec2:*SecurityGroup
            - ec2:*SecurityGroupEgress
            - ec2:*SecurityGroupIngress
            - ec2:AllocateAddress
            - ec2:ReleaseAddress
            - ec2:AssociateAddress
            - ec2:DisassociateAddress
            - ec2:RunInstances
            - ec2:TerminateInstances
            - ec2:StartInstances
            - ec2:StopInstances
            - ec2:ModifyInstanceAttribute
            - ec2:ModifyInstanceMetadataOptions
            - ec2:AssociateIamInstanceProfile
            - ec2:DisassociateIamInstanceProfile
            - ec2:ReplaceIamInstanceProfileAssociation
            - ec2:*LaunchTemplate
            - ec2:*LaunchTemplateVersions
          Resource: "*"
        - Sid: NoPeeringTransitOrNatGateways
          Effect: Deny
          Action:
            - ec2:*VpcPeeringConnection
            - ec2:*TransitGateway*
            - ec2:*VpnConnection*
            - ec2:*VpnGateway
            - ec2:*ClientVpn*
            - ec2:*NatGateway
          Resource: "*"
        # The image pipeline, recipe, components, infrastructure and distribution, and the images it keeps.
        - Sid: ImageBuilder
          Effect: Allow
          Action:
            - imagebuilder:*
            - ec2:DeregisterImage
            - ec2:DeleteSnapshot
          Resource: "*"
        - Sid: ImageBuilderServiceLinkedRole
          Effect: Allow
          Action: iam:CreateServiceLinkedRole
          Resource: !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:role/aws-service-role/imagebuilder.amazonaws.com/AWSServiceRoleForImageBuilder
          Condition:
            StringEquals:
              iam:AWSServiceName: imagebuilder.amazonaws.com
        - Sid: Schedules
          Effect: Allow
          Action:
            - scheduler:CreateSchedule
            - scheduler:UpdateSchedule
            - scheduler:DeleteSchedule
            - scheduler:GetSchedule
            - scheduler:ListSchedules
            - scheduler:TagResource
            - scheduler:UntagResource
            - scheduler:ListTagsForResource
          Resource: "*"
        - Sid: PatchScanAndAmiParameter
          Effect: Allow
          Action:
            - ssm:CreateAssociation
            - ssm:UpdateAssociation
            - ssm:DeleteAssociation
            - ssm:DescribeAssociation
            - ssm:ListAssociations
            - ssm:AddTagsToResource
            - ssm:RemoveTagsFromResource
            - ssm:ListTagsForResource
            - ssm:GetParameter
            - ssm:GetParameters
            - ssm:PutParameter
            - ssm:DeleteParameter
          Resource: "*"
        # The tier's own roles: named hkb-net-*, created only under hkb-workload-boundary (the
        # boundary's deny), passed only to EC2, Image Builder and Scheduler.
        - Sid: TierRoles
          Effect: Allow
          Action:
            - iam:GetRole
            - iam:CreateRole
            - iam:DeleteRole
            - iam:UpdateRole
            - iam:UpdateAssumeRolePolicy
            - iam:TagRole
            - iam:UntagRole
            - iam:PutRolePolicy
            - iam:DeleteRolePolicy
            - iam:GetRolePolicy
            - iam:AttachRolePolicy
            - iam:DetachRolePolicy
            - iam:ListRolePolicies
            - iam:ListAttachedRolePolicies
            - iam:PutRolePermissionsBoundary
            - iam:CreateInstanceProfile
            - iam:DeleteInstanceProfile
            - iam:GetInstanceProfile
            - iam:AddRoleToInstanceProfile
            - iam:RemoveRoleFromInstanceProfile
            - iam:TagInstanceProfile
          Resource:
            - !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:role/hkb-net-*
            - !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:instance-profile/hkb-net-*
        - Sid: PassTierRoles
          Effect: Allow
          Action: iam:PassRole
          Resource: !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:role/hkb-net-*
          Condition:
            StringEquals:
              iam:PassedToService:
                - ec2.amazonaws.com
                - imagebuilder.amazonaws.com
                - scheduler.amazonaws.com
                - vpc-flow-logs.amazonaws.com
        # VPC flow logs to CloudWatch Logs, 30 days (DQ-121); log groups only under /hkb/network/.
        - Sid: FlowLogs
          Effect: Allow
          Action:
            - ec2:CreateFlowLogs
            - ec2:DeleteFlowLogs
            - logs:DescribeLogGroups
            - logs:DescribeIndexPolicies       # drift detection reads the log group with these and
            - logs:DescribeResourcePolicies    # GetDataProtectionPolicy below (DQ-145)
          Resource: "*"
        - Sid: FlowLogGroup
          Effect: Allow
          Action:
            - logs:CreateLogGroup
            - logs:DeleteLogGroup
            - logs:PutRetentionPolicy
            - logs:DeleteRetentionPolicy
            - logs:TagResource
            - logs:UntagResource
            - logs:ListTagsForResource
            - logs:GetDataProtectionPolicy
          Resource: !Sub arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/hkb/network/*
        # Encrypted root volumes: grants only for AWS resources (EBS), from this account's keys.
        - Sid: EbsKeyGrants
          Effect: Allow
          Action: kms:CreateGrant
          Resource: !Sub arn:${AWS::Partition}:kms:*:${AWS::AccountId}:key/*
          Condition:
            Bool:
              kms:GrantIsForAWSResource: "true"
        - Sid: EbsKeys
          Effect: Allow
          Action:
            - kms:Decrypt
            - kms:DescribeKey
            - kms:Encrypt
            - kms:GenerateDataKey*
            - kms:ReEncrypt*
          Resource: !Sub arn:${AWS::Partition}:kms:*:${AWS::AccountId}:key/*
          Condition:
            StringLike:
              kms:ViaService: ec2.*.amazonaws.com
        - Sid: ListKeys
          Effect: Allow
          Action: kms:ListAliases
          Resource: "*"

Page information

Owner
Identity and Access
Status
current Current: generated from the templates and records in the repository at this build.
Generated from
baseline/hkb-baseline-network.yaml
Linked from
VPC, VPC, VPC, Access, Roles, Network roles
Plain markdown
/wiki/roles/network/hkb-pipeline-cfn-network/index.md