What's the most efficient way to determine the minimum AWS permissions necessary for a Terraform configuration?

后端 未结 4 1423
日久生厌
日久生厌 2020-12-24 08:50

I have a Terraform configuration targeting deployment on AWS. It applies beautifully when using an IAM user that has permission to do anything (i.e. {actions: [\"*\"],

4条回答
  •  时光取名叫无心
    2020-12-24 09:28

    Efficient way I followed.

    The way I deal with is, allow all permissions (*) for that service first, then deny some of them if not required.

    For example

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Sid": "AllowSpecifics",
                "Action": [
                    "ec2:*",
                    "rds:*",
                    "s3:*",
                    "sns:*",
                    "sqs:*",
                    "iam:*",
                    "elasticloadbalancing:*",
                    "autoscaling:*",
                    "cloudwatch:*",
                    "cloudfront:*",
                    "route53:*",
                    "ecr:*",
                    "logs:*",
                    "ecs:*",
                    "application-autoscaling:*",
                    "logs:*",
                    "events:*",
                    "elasticache:*",
                    "es:*",
                    "kms:*",
                    "dynamodb:*"
                ],
                "Effect": "Allow",
                "Resource": "*"
            },
            {
                "Sid": "DenySpecifics",
                "Action": [
                    "iam:*User*",
                    "iam:*Login*",
                    "iam:*Group*",
                    "iam:*Provider*",
                    "aws-portal:*",
                    "budgets:*",
                    "config:*",
                    "directconnect:*",
                    "aws-marketplace:*",
                    "aws-marketplace-management:*",
                    "ec2:*ReservedInstances*"
                ],
                "Effect": "Deny",
                "Resource": "*"
            }
        ]
    }
    

    You can easily adjust the list in Deny session, if terraform doesn't need or your company doesn't use some aws services.

提交回复
热议问题