Skip to content

Building Custom Resources

This section describes how to build and upload templates and artifacts to use in a customized deployment. Once uploaded, the locations of the templates and artifacts are used when deploying the Nextflow on AWS Batch solution (see Customized Deployment)

Building a Custom Distribution

This step involves building a distribution of templates and artifacts from the solution's source code.

First, create a local clone of the Genomics Workflows on AWS source code. The code base contains several directories:

  • _scripts/: Shell scripts for building and uploading the customized distribution of templates and artifacts
  • docs/: Source code for the documentation, written in MarkDown for the MkDocs publishing platform. This documentation may be modified, expanded, and contributed in the same way as source code.
  • src/: Source code for the components of the solution:
    • containers/: CodeBuild buildspec files for building AWS-specific container images and pushing them to ECR
      • _common/
        • A generic build script that first builds a base image for a container, then builds an AWS specific image
        • A generic entrypoint script that wraps a call to a binary tool in the container with handlers data staging from/to S3
      • nextflow/
        • Dockerfile
        • Docker entrypoint script to execute the Nextflow workflow on AWS Batch
    • ebs-autoscale/
    • ecs-additions/: Scripts to be installed on ECS host instances to support the distribution
      • Installed as /opt/aws-cli/bin/aws and mounted onto the container, allows container images without full glibc to use the AWS CLI v2 through supplied shared libraries (especially libz) and LD_LIBRARY_PATH.
      • Utility script to install, Nextflow and Cromwell shims, and swap space
      • Uses AWS CLI to download and run scripts and zip files from S3
      • Appended to the userdata in the launch template created by gwfcore-launch-template: Starts SSM Agent, ECS Agent, Docker; runs, and orchestrator-specific ecs-additions- scripts.
    • lambda/: Lambda functions to create, modify or delete ECR registries or CodeBuild jobs
    • templates/: CloudFormation templates for the solution stack, as described in Customized Deployment

Deploying a Custom Distribution

The script _scripts/ will create a custom distribution of artifacts and templates from files in the source tree, then upload this distribution to an S3 bucket. It will optionally also build and deploy a static documentation site from the Markdown documentation files. Its usage is: [--site-bucket BUCKET] [--asset-bucket BUCKET] 
              [--asset-profile PROFILE] [--deploy-region REGION] 
              [--public] [--verbose] 

    --site-bucket BUCKET        Deploy documentation site to BUCKET
    --asset-bucket BUCKET       Deploy assets to BUCKET
    --asset-profile PROFILE     Use PROFILE for AWS CLI commands
    --deploy-region REGION      Deploy in region REGION
    --public                    Deploy to public bucket with '--acl public-read' (Default false)
    --verbose                   Display more output
    STAGE                       'test' or 'production'

When running this script from the command line, use the value test for the stage. This will deploy the templates and artifacts into a directory test in your deployment bucket:

$ aws s3 ls s3://my-deployment-bucket/test/
    PRE artifacts/
    PRE templates/

Use these values when deploying a customized installation, as described in Customized Deployment, sections 'Artifacts and Nested Stacks' and 'Nextflow'. In the example from above, the values to use would be:

  • Artifact S3 Bucket Name: my-deployment-bucket
  • Artifact S3 Prefix: test/artifacts
  • Template Root URL:

The use of production for stage is reserved for deployments from a Travis CI/CD environment; this usage will deploy into a subdirectory named after the current release tag.