Setting up Automatic Resource Remediation with AWS Config

1.5 hours
  • 4 Learning Objectives

About this Hands-on Lab

Welcome to this AWS hands-on lab, Setting up Automatic Resource Remediation with AWS Config.

This activity provides you with the opportunity to get hands-on experience creating rules in AWS Config and implementing remediations using Lambda functions. This approach helps maintain a highly-secure networking architecture inside of AWS.

Good luck and enjoy the hands-on lab!

Resources for this activity are on the [Github Repository](https://github.com/julielkinsfembotit/LALabsAWSConfig).

**NOTE**: CloudWatch Events is now EventBridge. You’ll be able to now create rules in Amazon EventBridge Event Rules. We also use a pool of shared AWS accounts for our lab environments. Once the previous user’s lab is terminated, we have a cleaner that reclaims any AWS resources, including EC2 instances, S3 buckets, etc. This prepares the environment for you to use it next. However, because Config uses CloudTrail as the source of its data, and CloudTrail records can’t be deleted, Config sometimes sees resources that no longer exist. To resolve it, we recommend you turn Config off and back on again in Config’s settings. Please see the note on this in the lab instructions to help. Also please note that Config can take a very long time to synchronize, possibly 20 minutes or more.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create AWS Config Rule

Create AWS Config Rule:

  1. Create an S3 bucket for AWS Config (the default name is fine)
  2. Choose role for AWS Config to send data to S3
  3. Use search box and type in SSH
  4. Choose the restricted-ssh Rule
  5. Review and confirm
Create SNS Topic
  • Create SNS Topic:
    1. Create topic
    2. Add name: mytopic
  • Create SNS Subscription:
    1. For Protocol select Email
    2. Add your personal email address
    3. Click Confirm Subscription
    4. Go to your email account
    5. Confirm your SNS subscription
Create Lambda Function
  • Create Lambda function:
    1. Click Create Function
    2. Add name: remediatesg
    3. Choose Python 3.6, 3.7, or later
    4. Choose existing IAM role
    5. Click Create Function
    6. Delete provided function code
    7. Use the GitHub link and copy the function code, then paste it into the Lambda console function code box
    8. Click Save

Note: If AWS Config has trouble detecting changes after a reasonable amount of time, go into AWS Config Settings and toggle it off and on again.

Create CloudWatch Rule
  • CloudWatch Events is now EventBridge. You’ll be able to now create rules in Amazon EventBridge Event Rules.
    1. Click into Rules in left navigation
    2. Click Create Rule
    3. Select Schedule not Event
    4. Add 1 minute
    5. Select Target, add Lambda Function remediates
    6. Click Create rule

Additional Resources

Make sure you are in us-east-1.

Get the code for the Lambda functions here:

Resources for this activity are on the Github Repository.

NOTE: We use a pool of shared AWS accounts for our lab environments. Once the previous user's lab is terminated, we have a cleaner that reclaims any AWS resources, including EC2 instances, S3 buckets, etc. This prepares the environment for you to use it next. However, because Config uses CloudTrail as the source of its data, and CloudTrail records can't be deleted, Config sometimes sees resources that no longer exist. To resolve it, we recommend you turn Config off and back on again in Config's settings. Please see the note on this in the lab instructions to help. Also please note that Config can take a very long time to synchronize, possibly 20 minutes or more.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?