by Valts Ausmanis · July 5, 2024
Every application that we deploy to AWS is built using multiple AWS services like API Gateway, Lambda, S3, EC2, EKS, VPC, etc. All of these deployed services consist of multiple AWS resources. To ensure that your AWS account is secure and follows to certain security checks, it’s important to track changes of these resources and continuously assess if the resource configuration complies with your ideal security rules. Luckily, we have AWS Config to record changes and assess your AWS resource configurations. In this article, we will look at how to start using AWS Config and set up 15 AWS Config rules that should be considered for any AWS account.
AWS Config ensures that we have an always up-to-date AWS resource inventory that is constantly evaluated against your ideal security rules, which is a must-have for every organization, regardless of its size. Its two main tasks are:
To enable AWS Config to start recording AWS resource configuration changes, navigate to AWS Config settings and:
Once the AWS Config resource recorder is enabled, the next step is to add AWS Config rules. This ensures that our AWS resources comply with our ideal configuration settings.
There are around 390 AWS Config managed rules that you can add. While it might be tempting to add as many rules as possible, I suggest starting with the minimum set of rules that should be enabled for any AWS account. Once the base rules are in place, evaluate your application's security requirements and add additional AWS Config rules as needed. This is a continuous process, and you should regularly evaluate the rules, especially when making significant changes to your application.
Now, let’s take a look at 15 AWS Config rules that every AWS account should have.
This rule checks that your S3 buckets do not allow public read access. While today, when you create a new S3 bucket, by default, all new buckets are private — I still would enable this rule and double-check it.
Ensures IAM user access keys are rotated. While we shouldn’t use persistent credentials at all and should use temporary ones instead, if there is still a need to use them, ensure that you rotate them frequently.
This rule checks if your IAM users' passwords or access keys haven’t been used for a while. Again, I wouldn’t create IAM users or access keys at all and use AWS IAM Identity Center to manage access to my AWS accounts, but if you use these at least ensure that this rule is added.
Checks that multi-factor authentication (MFA) is enabled for the root account. Due to the over-permissive privileges, we shouldn’t use root user at all except for a few specific use cases.
Checks that EC2 instances do not have a public IP address. Security best practices suggests that you should avoid using EC2 instances with unnecessary public IP addresses in order to reduce the attack surface.
Ensures RDS instances are not publicly accessible . EC2 instances, Lambda functions, ECS tasks, etc. should access our RDS databases via a private network (VPC), ensuring that DB connections and data transfer do not go over the public internet.
Checks that the default security group of every VPC does not allow inbound or outbound traffic.
This rule ensures that your IAM password policy requires a minimum password length and includes specific character types. The fact that our AWS accounts should have a configured IAM password policy is not in question. By enabling this rule, we ensure additionally that there is a policy that meets certain requirements.
Checks that EBS encryption is enabled by default. This setting ensures that whenever you create new EBS volume – encryption will be enabled by default.
This rule ensures that S3 should be encrypted by default.
Ensures that DynamoDB tables are encrypted at rest.
Checks that RDS storage is encrypted. While most AWS services have encryption at rest enabled by default, it is still recommended to include storage encryption checks as part of best practices.
Ensures Lambda functions are not publicly accessible. If you grant access to your Lambda functions to other AWS accounts, it is suggested that you have this rule in place to ensure that the access policy doesn’t contain a wildcard. For example, the principal element should not be ""
or { "AWS": ""}
.
Checks whether ACM certificates in your account are marked for expiration within a specific number of days. This rule is especially important for manually imported certificates that ACM does not renew automatically.
Checks that VPC flow logs are enabled. Whenever you use Amazon VPC for your back-end services, you should consider enabling flow logs. This will help with your audit process and, of course, troubleshooting when something goes wrong.
Ensures AWS CloudTrail is enabled. CloudTrail logs contain details about all the API calls made within your AWS account (including usage in the AWS console). These logs can then be used to track changes, troubleshoot security incidents, and ensure compliance with your internal policies.
While AWS Config does a great job recording and assessing resource configuration changes, it can get expensive if you have many resources that change frequently. Your AWS Config costs are based on two main usage types:
I suggest to closely monitor usage costs for AWS config and then optimize your settings, for example, disable or update some “expensive” rules, exclude unnecessary resources, change configuration item recording schedule to Periodic etc.
With AWS Config you can start to record changes of your AWS resources with few simple clicks and have a nice AWS resource inventory up and running in no time. The more challenging part is to enable right AWS config rules. There are around 390 AWS Config managed rules to choose from, and it can be easy to get confused when you start adding AWS Config rules. That’s why I created and described in detail a list of 15 AWS Config rules that you should add to any AWS account. This will provide a good foundation to start improving your security posture. By using AWS Config, we are taking another step in the continuous journey of improving the security of our AWS accounts.
Tired of browsing through the AWS console?
Try out Cloudviz.io and visualize your AWS cloud environment in seconds
As experienced AWS architects and developers, our goal is to provide users an easy way to create stunning AWS architecture diagrams and detailed technical documentation. Join us to simplify your diagramming process and unleash the beauty of your cloud infrastructure
Support
Contact
Copyright © 2019 - 2024 Cloudviz Solutions SIA