Skip to content

Instantly share code, notes, and snippets.

@bwbaugh
Created March 15, 2016 06:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwbaugh/2f3827e798d821bff03d to your computer and use it in GitHub Desktop.
Save bwbaugh/2f3827e798d821bff03d to your computer and use it in GitHub Desktop.
EC2 user data script to install Haskell stack on Amazon Linux in order to build executables for AWS Lambda.
#!/bin/bash
yum update -y
curl -sSL https://s3.amazonaws.com/download.fpcomplete.com/centos/7/fpco.repo | tee /etc/yum.repos.d/fpco.repo
yum -y install stack
sudo -H -u ec2-user -- stack setup
# TODO(2016-04-14): Maybe download files and run `stack build`.
# NOTE: This script is mostly just for fun // a learning exercise. It's
# probably better to use something like Travis CI that can cache the
# ~/.stack/ directory to make build times reasonable. Though the
# whole point of this is to run on Amazon Linux for building static
# executables to run on AWS Lambda.
# To build a static executable, he ghc-options in the cabal file will
# need to be set to:
# -fforce-recomp -static -optc-static -optl-static -optl-pthread
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment