{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "S3BucketCreatePermissions",
      "Effect": "Allow",
      "Action": [
        "s3:CreateBucket",
        "s3:PutBucketPublicAccessBlock",
        "s3:ListBucket",
        "s3:PutBucketPolicy",
        "s3:PutEncryptionConfiguration"
      ],
      "Resource": [
        "arn:aws:s3:::aws-quick-setup-config-recording-*"
      ],
      "Condition": {
        "StringEquals": {
          "aws:ResourceAccount": "${aws:PrincipalAccount}"
        }
      }
    },
    {
      "Sid": "SNSTopicsListPermissions",
      "Effect": "Allow",
      "Action": [
        "sns:ListTopics"
      ],
      "Resource": "*"
    },
    {
      "Sid": "DefaultSNSTopicCreatePermissions",
      "Effect": "Allow",
      "Action": [
        "sns:CreateTopic"
      ],
      "Resource": "arn:aws:sns:*:*:ConfigRecording-Default-Topic"
    },
    {
      "Sid": "ConfigureAndStartConfigurationRecorderPermissions",
      "Effect": "Allow",
      "Action": [
        "config:DescribeConfigurationRecorders",
        "config:DescribeDeliveryChannels",
        "config:PutConfigurationRecorder",
        "config:PutDeliveryChannel",
        "config:StartConfigurationRecorder"
      ],
      "Resource": "*"
    },
    {
      "Sid": "GetAndPassConfigSLRPermissions",
      "Effect": "Allow",
      "Action": [
        "iam:GetRole",
        "iam:PassRole"
      ],
      "Resource": [
        "arn:aws:iam::*:role/aws-service-role/config.amazonaws.com/AWSServiceRoleForConfig",
        "arn:aws:iam::*:role/AWSServiceRoleForConfig"
      ]
    },
    {
      "Sid": "CreateConfigSLRPermissions",
      "Effect": "Allow",
      "Action": [
        "iam:CreateServiceLinkedRole"
      ],
      "Resource": [
        "arn:aws:iam::*:role/aws-service-role/config.amazonaws.com/AWSServiceRoleForConfig"
      ],
      "Condition": {
        "StringEquals": {
          "iam:AWSServiceName": "config.amazonaws.com"
        }
      }
    },
    {
      "Effect": "Allow",
      "Action": "ssm:GetCalendarState",
      "Resource": "arn:aws:ssm:*:*:document/*",
      "Condition": {
        "StringLike": {
          "aws:userid": "*:SystemsManager-Automation-ChangeCalendar-Check"
        },
        "StringEquals": {
          "ssm:DocumentType": "ChangeCalendar"
        }
      }
    }
  ]
}
