Version Control & Auto-Deploy your Files Stored in Amazon EFS

Although the primary use case of Amazon EFS is to be used as an NFS, occasionally it could hold the kind of data that lends well to version control. A WordPress installation is one such example. And where there is version control, automated deployment pipelines aren’t far behind. This article describes a way for you to automatically deploy files from a CodeCommit repository to an EFS file system, whenever a change is pushed to the repo. We do this by creating a pipeline as shown below:

Skip the deploy stage & create the pipeline. The build spec is where you put commands to copy everything from the CodeCommit repo to the EFS mount point inside the CodeBuild instance. The env var CODEBUILD_SRC_DIR in CodeBuild holds the location of the contents of the CodeCommit repo. All you have to do is copy this to the EFS using a command like cp -Rf $CODEBUILD_SRC_DIR/ /my-efs/.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.