During the setup of the configuration recorder, you will create and specify the IAM role that the recorder will need to gain read-only access to the resources to record the configuration items. The role also needs read and write permissions for the designated S3 bucket in order to publish the configuration snapshots. Permissions are also required for any KMS keys used to encrypt the snapshot along with publishing notifications to the SNS topics.
As you create the IAM role in the steps of the Basic Setup of Configuration Recorder example, you will see all the permissions in a policy file.
When a change against a resource occurs in your environment, the result is that a new configuration item is created. When that new configuration item is created, it is automatically added to a configuration stream, which is essentially an SNS topic. As you will see, when you set up your configuration recorder to capture the resources and changes in your AWS environment, you can specify the SNS topic for your stream.
When you declare the SNS topic for your configuration stream, especially for a topic you are actively monitoring, it helps you identify potential unexpected issues or security incidents.
For a hands-on example of the Config service, you will now set up the service using the CLI:
aws s3 mb s3://packt-config –Region us-east-2
aws sns create-topic –name packt-config
If it was successful, you should get a response like the one that follows. You will need to save the ARN for when you later create your delivery channel:
————————————————————-
| CreateTopic |
+———-+————————————————-+
| TopicArn|
arn:aws:sns:us-east-1:1234567890:packt-config |
+———-+————————————————-+
{
“Version”: “2012-10-17”,
“Statement”: [
{
“Sid”: “AssumeRole”,
“Effect”: “Allow”,
“Principal”: {
“Service”: “config.amazonaws.com”
},
“Action”: “sts:AssumeRole”,
“Condition”: {
“StringEquals”: {
“AWS:SourceAccount”: “1234567890”
}
}
}
]
}
aws iam create-role –role-name Packt-Config –assume-role-policy-document file://iam_config.json
arn:aws:iam::1234567890:role/Packt-Config
{
“Version”: “2012-10-17”,
“Statement”: [
{
“Sid”: “ConfigS3PutPolicy”,
“Effect”: “Allow”,
“Action”:[
“s3:PutObject”,
“s3:PutObjectAcl”
],
“Resource”:[
“arn:aws:s3:::packt-config/*”
],
“Condition”:{
“StringLike”:{
“s3:x-amz-acl”:”bucket-owner-full-control”
}
}
},
{
“Sid”: “ConfigS3GetPolicy”,
“Effect”: “Allow”,
“Action”:[ “s3:GetBucketAcl” ],
“Resource”: “arn:aws:s3:::packt-config”
},
{
“Sid”: “ConfigSNSPolicy”,
“Effect”: “Allow”,
“Action”: “sns:Publish”,
“Resource”: “arn:aws:sns:us-east-1:182968331794:packt-config”
},
{
“Sid”: “DescribeResources”,
“Effect”: “Allow”,
“Action”:[
“ec2:Describe*”
],
“Resource”: “*”
}
]
}