Blog

A custom provider for EFS Provisioned Throughput

16 Jul, 2018
Xebia Background Header Wave

On July the 12th, 2018, Amazon announced the availability of Provisioned throughput for EFS volumes. This is a very valuable feature for anybody using EFS. Unfortunately, it can only be enabled through the
Console or the API. Although the Console is nice for playing around, it is not suitable for engineering solutions on AWS. With this custom provider you can specify provisioned throughput for EFS in CloudFormation, 4 days after the release!
On August the 8th, we discovered that the properties ThroughputMode and ProvisionedThroughputInMibs can now be set in AWS::EFS::FileSystem, making this provider obsolete!

How do you add provisioned throughput?

It was quite easy: you specified a CloudFormation resource of the type Custom::EfsProvisionedThroughput, as follows:

    ## Obsolete now. just specify ThroughputMode and ProvisionedThroughputInMibs on AWS::EFS::FileSystem
    EfsProvisionedThroughput:
      Type: Custom::EfsProvisionedThroughput
      Properties: 
        FileSystemId: !Ref EFS
        ThroughputMode: provisioned
        ProvisionedThroughputInMibs: 1024.0
        ServiceToken: !Sub 'arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:binxio-cfn-efs-provisioned-throughput-provider'

After the deployment, the EFS has the provisioned throughput. When the resource is deleted, the throughput mode is restored to ‘bursting’

Installation

To install this custom resource, type:

aws cloudformation create-stack \
 --capabilities CAPABILITY_IAM \
 --stack-name cfn-efs-provisioned-throughput-provider \
 --template-body file://cloudformation/cfn-resource-provider.yaml

aws cloudformation wait stack-create-complete  --stack-name cfn-efs-provisioned-throughput-provider

This CloudFormation template will use our pre-packaged provider from s3://binxio-public-${AWS::Region}/lambdas/cfn-efs-provisioned-throughput-provider-1.0.1.zip.

Conclusion

With this custom provider you can specify provisioned throughput for EFS in CloudFormation. Although creating this temporary custom provider
cost less than 2 hours, it is not the ideal solution. It has to be created, installed and decommissioned when Amazon finally adds the properties

ThroughputMode and ProvisionedThroughputInMibs to the AWS::EFS::FileSystem.
If it helps, I would like to offer AWS our services to ensure that CloudFormation is always on-par with the API before the feature is released.

Mark van Holsteijn
Mark van Holsteijn is a senior software systems architect at Xebia Cloud-native solutions. He is passionate about removing waste in the software delivery process and keeping things clear and simple.
Questions?

Get in touch with us to learn more about the subject and related solutions

Explore related posts