When expanding a Elastic Block Storage (EBS) volume connected to an Elastic Compute Cloud (Ec2) instance, be it through automation of manually through the AWS Console, there was a manual step to go into the operating system and expand the partition to take advantage of the newly allocated space.
With this Lambda, this is now automated.
- Something triggers the modification of an EBS Volume
- Like any API call, the ModifyVolume call gets logged in Cloudtrail.
- Cloudwatch events has a rule that triggers on a certain event and starts a lambda function.
- The Lambda function
- Checks if a change has been made to the volume's size. If not, it stops.
- It finds the Instance connected to the volume being modified.
- It will find the OS of the instance
- It will trigger the right System Manger document to run against the instance
- The document scans for changes to it's attached storage and expands any volume that has more partition-able space than is in use.
- Linux support
$ sls deploy
$ sls deploy function -f partitionextension --region eu-west-1
$ sls remove