Innablr / revolver

AWS Powercycle Facility
MIT License
3 stars 3 forks source link

Document deployment requirements, especially around security #29

Open lyricnz opened 10 months ago

lyricnz commented 10 months ago
simon-anz commented 10 months ago

Current AWS-client commands used by the code, which in turn will require IAM permissions:

egrep -R '^import.*Command[, ]' actions lib drivers | sort

drivers/ec2.ts

drivers/rdsCluster.ts

drivers/rdsInstance.ts

drivers/redshiftCluster.ts

drivers/redshiftClusterSnapshot.ts

drivers/tags.ts

lib/config.ts

simon-anz commented 10 months ago

Plus:

simon-anz commented 10 months ago

Implemented with:

  managed_policy_arns = [
    "arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole",
    "arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess",
    "arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess",
    "arn:aws:iam::aws:policy/AmazonRDSReadOnlyAccess",
  ]

(could make do with less - see above), plus

  policy_statements = [
    {
      Action = [
        "autoscaling:ResumeProcesses",
        "autoscaling:SuspendProcesses",
        "ec2:CreateTags",
        "ec2:DeleteTags",
        "ec2:StartInstances",
        "ec2:StopInstances",
        "rds:AddTagsToResource",
        "rds:RemoveTagsFromResource",
        "rds:StartDBCluster",
        "rds:StartDBInstance",
        "rds:StopDBCluster",
        "rds:StopDBInstance",
      ]
      Effect   = "Allow"
      Resource = "*"
    },
  ]
lyricnz commented 10 months ago

TODO: redshift

alutman-innablr commented 9 months ago
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "RevolverPermissionsRDS",
      "Effect": "Allow",
      "Action": [
        "rds:ListTagsForResource",
        "rds:AddTagsToResource",
        "rds:RemoveTagsFromResource",
        "rds:DescribeDBInstances",
        "rds:DescribeDBClusters",
        "rds:StartDBInstance",
        "rds:StopDBInstance",
        "rds:StartDBCluster",
        "rds:StopDBCluster"
      ],
      "Resource": "*"
    },
    {
      "Sid": "RevolverPermissionsEC2",
      "Effect": "Allow",
      "Action": [
        "ec2:DescribeTags",
        "ec2:CreateTags",
        "ec2:DeleteTags",
        "ec2:DescribeInstances",
        "ec2:DescribeSnapshots",
        "ec2:DescribeVolumes",
        "ec2:StartInstances",
        "ec2:StopInstances",
        "autoscaling:DescribeAutoScalingGroups",
        "autoscaling:ResumeProcesses",
        "autoscaling:SuspendProcesses"
      ],
      "Resource": "*"
    },
    {
      "Sid": "RevolverPermissionsRedshift",
      "Effect": "Allow",
      "Action": [
        "redshift:DescribeTags",
        "redshift:CreateTags",
        "redshift:DeleteTags",
        "redshift:DescribeClusters",
        "redshift:DescribeClusterSnapshots",
        "redshift:DeleteCluster",
        "redshift:DeleteClusterSnapshot"
      ],
      "Resource": "*"
    }
  ]
}