VOOZH about

URL: https://thenewstack.io/avoid-the-5-most-common-amazon-web-services-misconfigurations-in-build-time/

⇱ Avoid the 5 Most Common Amazon Web Services Misconfigurations in Build-Time - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2020-10-09 13:58:37
Avoid the 5 Most Common Amazon Web Services Misconfigurations in Build-Time
contributed,sponsor-bridgecrew,sponsored,sponsored-post-contributed,
DevOps / Security

Avoid the 5 Most Common Amazon Web Services Misconfigurations in Build-Time

Infrastructure-as-code (IaC) gives you the opportunity to make relatively simple changes that can have a lasting impact on your cloud security posture.
Oct 9th, 2020 1:58pm by Nimrod Kor
👁 Featued image for: Avoid the 5 Most Common Amazon Web Services Misconfigurations in Build-Time
Feature image via Pixabay.
Bridgecrew sponsored this post.
Nimrod Kor
Nimrod Kor is a Solutions Architect and founding team member at Bridgecrew, where he leads cloud security research projects and helps teams adopt codified cloud security.
Infrastructure-as-code (IaC) makes cloud provisioning faster, simpler and more scalable. It also gives us the opportunity to make relatively simple changes that can have a lasting impact on our cloud security posture. To demonstrate this, we analyzed the most common Amazon Web Services (AWS) security errors across IaC modules in the wild. In this post, we’re looking at the most common non-compliant AWS policies and the risks associated with them. We’ll also share the simple build-time Terraform configuration needed to fix each error.

Ensure All Data Stored in S3 Bucket Is Securely Encrypted at Rest

S3 supports easy, free encryption using the AES-256 encryption standard. As I’m sure we’re all aware, S3 Bucket encryption at rest is important to prevent your data from being exposed to anyone who might get access to the hard drives that store your data. To be compliant with this policy, which is required for PCI-DSS and NIST-800, encryption needs to be set by default on the relevant bucket(s). This will cause all subsequent items saved to that S3 bucket to be encrypted automatically. Add the following block to a Terraform S3 resource to add AES-256 encryption:
server_side_encryption_configuration {
 rule {
 apply_server_side_encryption_by_default {
 sse_algorithm = "AES256"
 }
 }
}

Ensure All Data Stored in the Launch Configuration EBS Is Securely Encrypted

Amazon Elastic Block Store (EBS) volumes support built-in encryption, but are not encrypted by default. EBS Launch Configurations specify the Amazon EC2 Auto Scaling launch configuration that can be used by an Auto Scaling group to configure Amazon EC2 instances. When the entire EBS volume is encrypted, data stored at rest on the volume, disk I/O, snapshots created from the volume, and data-in-transit between EBS and EC2 are all encrypted.
Bridgecrew is the codified cloud security platform for developers. By equipping teams with security-as-code and DevSecOps workflows, Bridgecrew automates infrastructure security throughout the development lifecycle.
Learn More
The latest from Bridgecrew
Keeping your data encrypted at rest ensures that no unauthorized entities gain access to it. Compliance with this policy is also required for PCI-DSS. To prevent this AWS error in your Terraform module, make sure that encryption is enabled for EBS Launch Configurations:
resource "aws_launch_configuration" "as_conf" {
 name_prefix = "terraform-lc-example-"
 image_id = data.aws_ami.ubuntu.id
 instance_type = "t2.micro"
+ encrypted = enabled

Ensure Rotation for Customer Created CMKs Is Enabled

AWS Key Management Service (KMS) allows customers to rotate backing keys. This is where key material is stored within the KMS and tied to the key ID of the customer master key (CMK). The backing key is used to perform cryptographic operations, such as encryption and decryption. Automatic key rotation currently retains all prior backing keys, allowing encrypted data decryption to occur transparently. The longer a key goes un-rotated, the more data gets encrypted with it, and the more likely it is of being compromised. Exposure of such a key exposes all the data that was encrypted using that key, so it is highly recommended to rotate the encryption key yearly. By default, automatic CMK rotation is not enabled (it is in Google Cloud!), but it is recommended to help reduce a compromised key’s potential impact. It is also a requirement to enable it for PCI-DSS, CSI, and ISO27001 compliance. To fix this misconfiguration in Terraform, turn on key rotation:
resource "aws_kms_key" "kms_key_1" {
 description = "kms_key_1"
 deletion_window_in_days = 10
 key_usage = "ENCRYPT_DECRYPT"
 is_enabled = true
 + enable_key_rotation = true
}

Ensure DynamoDB Point-in-time Recovery (Backup) Is Enabled

Point-in-Time Recovery (PITR) for Amazon DynamoDB allows you to restore your DynamoDB table data with a single click. This gives you a fail-safe when digging into data breaches and data corruption attacks, and is a requirement for PIC-DSS, CIS, and ISO27001. To create and access DynamoDB backups, however, you need to enable PITR, which provides continuous backups that can be controlled using various programmatic parameters. Fix this misconfiguration by configure the point_in_time configurations on your DynamoDB table:
resource "aws_dynamodb_table" "basic-dynamodb-table" {
 name = "GameScores"
 billing_mode = "PROVISIONED"
 read_capacity = 20
 write_capacity = 20
 hash_key = "UserId"
 range_key = "GameTitle"
+ point_in_time-recovery = enabled

Ensure ECR Image Scanning on Push Is Enabled

Amazon ECR supports scanning your container images for vulnerabilities using the Common Vulnerabilities and Exposures (CVEs) database. It is recommended that you enable ECR on every push, to help identify bad images and specific tags where vulnerabilities were introduced into the image. Enabling ECR scanning on every push is required as part of ISO27001 compliance. To fix build-time resources, set `scan_on_push` to `true`:
resource "aws_ecr_repository" "foo" {
 name = "bar"
 image_tag_mutability = "MUTABLE"

 image_scanning_configuration {
+ scan_on_push = true
 }
}

Ensure All Data Stored in the SQS Queue Is Encrypted

Amazon Simple Queue Service (Amazon SQS) allows encrypting messages sent through each and every queue. This allows for another level of data access management, by denying access to specific data based on the encryption of the message, and protects sensitive data by encrypting it. If you operate in a regulated market, such as HIPAA for healthcare, PCI DSS for finance, and FedRAMP for government, you need to ensure sensitive data messages passed in this service are encrypted at rest. Avoid this misconfiguration by specifying the KMS key that the SQS should use to encrypt the data on the SQS configuration block. In Terraform, set the length of time, in seconds, for which Amazon SQS can reuse a data key to encrypt or decrypt messages before calling AWS KMS again.
resource "aws_sqs_queue" "terraform_queue" {
 name = "terraform-example-queue"
+ kms_master_key_id = "alias/aws/sqs"
+ kms_data_key_reuse_period_seconds = 300
}

Conclusion

As you can see, fixing IaC misconfigurations often entails adding simple missing configuration arguments to already-existing blocks, or changing incorrect values to the compliant state. Making those small changes, however, can have a significant impact as they will inform future deployments. By enforcing common security policies in IaC templates and modules at build-time, you can fix existing issues and prevent new misconfigurations from being deployed. It’s also a great way to save time hunting down issues in production that keep resurfacing when new infrastructure gets spun up. That’s why we at Bridgecrew believe IaC is a must for organizations with a growing presence in the cloud.
Bridgecrew is the codified cloud security platform for developers. By equipping teams with security-as-code and DevSecOps workflows, Bridgecrew automates infrastructure security throughout the development lifecycle.
Learn More
The latest from Bridgecrew
TRENDING STORIES
Nimrod Kor is a Solutions Architect and founding team member at Bridgecrew, where he leads cloud security research projects and helps teams adopt codified cloud security.
Read more from Nimrod Kor
Bridgecrew sponsored this post.
SHARE THIS STORY
TRENDING STORIES
Amazon Web Services is a sponsor of The New Stack.
TNS owner Insight Partners is an investor in: Pragma.
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.