Project: KICS (Provisioning / Security & Compliance)
File: 8dd0ff1f-0da4-48df-9bb3-7f338ae36a40.md

title: EC2 Not EBS Optimized hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: 8dd0ff1f-0da4-48df-9bb3-7f338ae36a40 Query name: EC2 Not EBS Optimized Platform: CloudFormation Severity: <span style="color:#5bc0de">Info</span> Category: Best Practices URL: It's considered a best practice for an EC2 instance to use an EBS optimized instance. This provides the best performance for your EBS volumes by minimizing contention between Amazon EBS I/O and other traffic from your instance<br> ```yaml title="Positive test num. 1 - yaml file" hl_lines="4" Resources: MyEC2Instance: Type: AWS::EC2::Instance Properties: ImageId: "ami-79fd7eee" KeyName: "testkey" BlockDeviceMappings: DeviceName: "/dev/sdm" Ebs: VolumeType: "io1" Iops: "200" DeleteOnTermination: "false" VolumeSize: "20" DeviceName: "/dev/sdk" NoDevice: {} ``` ```json title="Positive test num. 2 - json file" hl_lines="5" { "Resources": { "MyEC2Instance": { "Type": "AWS::EC2::Instance", "Properties": { "ImageId": "ami-79fd7eee", "KeyName": "testkey", "BlockDeviceMappings": [ { "DeviceName": "/dev/sdm", "Ebs": { "VolumeType": "io1", "Iops": "200", "DeleteOnTermination": "false", "VolumeSize": "20" } }, { "DeviceName": "/dev/sdk", "NoDevice": {} } ] } } } } ``` ```yaml title="Positive test num. 3 - yaml file" hl_lines="16" Resources: MyEC2Instance: Type: AWS::EC2::Instance Properties: ImageId: "ami-79fd7eee" KeyName: "testkey" BlockDeviceMappings: DeviceName: "/dev/sdm" Ebs: VolumeType: "io1" Iops: "200" DeleteOnTermination: "false" VolumeSize: "20" DeviceName: "/dev/sdk" NoDevice: {} EbsOptimized: false ``` <details><summary>Positive test num. 4 - json file</summary> ```json hl_lines="23" { "Resources": { "MyEC2Instance": { "Type": "AWS::EC2::Instance", "Properties": { "ImageId": "ami-79fd7eee", "KeyName": "testkey", "BlockDeviceMappings": [ { "DeviceName": "/dev/sdm", "Ebs": { "VolumeType": "io1", "Iops": "200", "DeleteOnTermination": "false", "VolumeSize": "20" } }, { "DeviceName": "/dev/sdk", "NoDevice": {} } ], "EbsOptimized": false } } } } ``` </details> <details><summary>Positive test num. 5 - yaml file</summary> ```yaml hl_lines="4" Resources: MyEC2Instance: Type: AWS::EC2::Instance Properties: InstanceType: t2.small ImageId: "ami-79fd7eee" KeyName: "testkey" BlockDeviceMappings: DeviceName: "/dev/sdm" Ebs: VolumeType: "io1" Iops: "200" DeleteOnTermination: "false" VolumeSize: "20" DeviceName: "/dev/sdk" NoDevice: {} ``` </details> <details><summary>Positive test num. 6 - json file</summary> ```json hl_lines="5" { "Resources": { "MyEC2Instance": { "Type": "AWS::EC2::Instance", "Properties": { "InstanceType": "t2.small", "ImageId": "ami-79fd7eee", "KeyName": "testkey", "BlockDeviceMappings": [ { "DeviceName": "/dev/sdm", "Ebs": { "VolumeType": "io1", "Iops": "200", "DeleteOnTermination": "false", "VolumeSize": "20" } }, { "DeviceName": "/dev/sdk", "NoDevice": {} } ] } } } } ``` </details> ```yaml title="Negative test num. 1 - yaml file" Resources: MyEC2Instance: Type: AWS::EC2::Instance Properties: ImageId: "ami-79fd7eee" KeyName: "testkey" BlockDeviceMappings: DeviceName: "/dev/sdm" Ebs: VolumeType: "io1" Iops: "200" DeleteOnTermination: "false" VolumeSize: "20" DeviceName: "/dev/sdk" NoDevice: {} EbsOptimized: true ``` ```json title="Negative test num. 2 - json file" { "Resources": { "MyEC2Instance": { "Type": "AWS::EC2::Instance", "Properties": { "ImageId": "ami-79fd7eee", "KeyName": "testkey", "BlockDeviceMappings": [ { "DeviceName": "/dev/sdm", "Ebs": { "VolumeType": "io1", "Iops": "200", "DeleteOnTermination": "false", "VolumeSize": "20" } }, { "DeviceName": "/dev/sdk", "NoDevice": {} } ], "EbsOptimized": true } } } } ``` ```yaml title="Negative test num. 3 - yaml file" Resources: MyEC2Instance: Type: AWS::EC2::Instance Properties: InstanceType: t3.nano ImageId: "ami-79fd7eee" KeyName: "testkey" BlockDeviceMappings: DeviceName: "/dev/sdm" Ebs: VolumeType: "io1" Iops: "200" DeleteOnTermination: "false" VolumeSize: "20" DeviceName: "/dev/sdk" NoDevice: {} ``` <details><summary>Negative test num. 4 - json file</summary> ```json { "Resources": { "MyEC2Instance": { "Type": "AWS::EC2::Instance", "Properties": { "InstanceType": "t3.nano", "ImageId": "ami-79fd7eee", "KeyName": "testkey", "BlockDeviceMappings": [ { "DeviceName": "/dev/sdm", "Ebs": { "VolumeType": "io1", "Iops": "200", "DeleteOnTermination": "false", "VolumeSize": "20" } }, { "DeviceName": "/dev/sdk", "NoDevice": {} } ] } } } } ``` </details>