Skip to content

Instantly share code, notes, and snippets.

@maraca
Created March 4, 2014 19:18
Show Gist options
  • Select an option

  • Save maraca/9353594 to your computer and use it in GitHub Desktop.

Select an option

Save maraca/9353594 to your computer and use it in GitHub Desktop.
Writing 2GB of data on c3.xlarge instance root volume, SSD volume and Provisioned EBS volume.
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Creates an EC2 instance with 2x SSD 40GB and an provisioned IOPS EBS volume.",
"Parameters" : {
"KeyName" : {
"Description" : "Name of the production EC2 KeyPair to enable SSH to the instance",
"Type" : "String"
},
"InstanceImageId" : {
"Description" : "EC2 image id (e.g. 'ami-d9d6a6b0'",
"Type" : "String"
},
"InstanceType" : {
"Description" : "EC2 instance type",
"Type" : "String",
"AllowedValues" : [ "c3.xlarge" ],
"ConstraintDescription" : "must be a valid EC2 instance type.",
"Default": "c3.xlarge"
},
"InstanceName" : {
"Description" : "Name to give to the Instance.",
"Type" : "String",
"Default": "DiskTroughputTest"
},
"EbsOptimized": {
"Description" : "EBS Optimized instance",
"Type": "String",
"Default": "true"
}
},
"Resources" : {
"Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"ImageId" : { "Ref" : "InstanceImageId" },
"InstanceType" : { "Ref" : "InstanceType" },
"KeyName" : { "Ref" : "KeyName" },
"EbsOptimized": { "Ref" : "EbsOptimized" },
"SecurityGroups": [ { "Ref": "InstanceSecurityGroup" } ],
"Tags" : [
{"Key" : "Name", "Value" : { "Ref" : "InstanceName" } }
]
}
},
"InstanceSecurityGroup" : {
"Type" : "AWS::EC2::SecurityGroup",
"Properties" : {
"GroupDescription" : "Open all (most) ports.",
"SecurityGroupIngress" : [
{ "IpProtocol" : "tcp",
"FromPort" : "0",
"ToPort" : "65000",
"CidrIp" : "0.0.0.0/0"
},
{ "IpProtocol" : "udp",
"FromPort" : "0",
"ToPort" : "65000",
"CidrIp" : "0.0.0.0/0"
}
]
}
},
"ProvisionedIOPSVolume": {
"Type": "AWS::EC2::Volume",
"Properties": {
"Size": "100",
"AvailabilityZone": { "Fn::GetAtt": [ "Instance", "AvailabilityZone"] },
"VolumeType" : "io1",
"Iops" : "1000"
}
},
"MountPoint" : {
"Type" : "AWS::EC2::VolumeAttachment",
"Properties" : {
"InstanceId" : { "Ref" : "Instance" },
"VolumeId" : { "Ref" : "ProvisionedIOPSVolume" },
"Device" : "/dev/sdh"
}
}
},
"Outputs" : {
"InstanceId" : {
"Description" : "InstanceId of the newly created EC2 instance",
"Value" : { "Ref" : "Instance" }
}
}
}
# Make mount directories
$ sudo mkdir /media/ssd_drive
$ sudo mkdir /media/ebs_drive
# In order, root volume, SSD, SDD, Provisioned IOPS
$ sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
NAME FSTYPE SIZE MOUNTPOINT LABEL
xvda1 ext4 10G / cloudimg-rootfs
xvdb ext3 40G /mnt
xvdc ext3 40G
xvdh 100G
$ sudo mkfs -t ext4 /dev/xvdc
mke2fs 1.42 (29-Nov-2011)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
2621440 inodes, 10483712 blocks
524185 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
320 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
ubuntu@ip-10-231-164-148:~$ sudo mkfs -t ext4 /dev/xvdh
mke2fs 1.42 (29-Nov-2011)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
6553600 inodes, 26214400 blocks
1310720 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
800 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
# Mount the drives.
$ sudo mount /dev/xvdc /media/ssd_drive
$ sudo mount /dev/xvdh /media/ebs_drive
$ sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
NAME FSTYPE SIZE MOUNTPOINT LABEL
xvda1 ext4 10G / cloudimg-rootfs
xvdb ext3 40G /mnt
xvdc ext4 40G /media/ssd_drive
xvdh ext4 100G /media/ebs_drive
# Root device
$ cd /
/$ sudo /bin/dd if=/dev/zero of=outfile.tmp bs=1M count=2048
2048+0 records in
2048+0 records out
2147483648 bytes (2.1 GB) copied, 2.13914 s, 1.0 GB/s
# SSD Drive
/$ cd /media/ssd_drive/
/media/ssd_drive$ sudo /bin/dd if=/dev/zero of=outfile.tmp bs=1M count=2048
2048+0 records in
2048+0 records out
2147483648 bytes (2.1 GB) copied, 14.6209 s, 147 MB/s
# EBS Volume
/media/ssd_drive$ cd /media/ebs_drive/
/media/ebs_drive$ sudo /bin/dd if=/dev/zero of=outfile.tmp bs=1M count=2048
2048+0 records in
2048+0 records out
2147483648 bytes (2.1 GB) copied, 21.751 s, 98.7 MB/s
# Results:
# Root Volume: 1.0 GB/s
# SSD Volume: 147 MB/s
# EBS Volume 1000 Provisioned IOPS: 98.7 MB/s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment