Skip to content

Instantly share code, notes, and snippets.

View folsen's full-sized avatar

Fredrik Harrysson folsen

View GitHub Profile
CIUSER=ci
ACCOUNTID=<account-id>
# Create ECR repo
aws ecr create-repository <repo> --region <region>
# Create the CI user with appropricate permissions
aws iam create-user --user-name $CIUSER
aws iam attach-user-policy --user-name $CIUSER --policy-arn arn:aws:iam::aws:policy/AWSElasticBeanstalkFullAccess
aws iam attach-user-policy --user-name $CIUSER --policy-arn arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryFullAccess
machine:
services:
- docker
dependencies:
cache_directories:
- "~/docker"
- "~/.cabal"
- "~/.local"
- "~/.stack"
# deploy.sh
#! /bin/bash
SHA1=$1
# Push image to ECR
$(aws ecr get-login --region <region>)
docker push <account-id>.dkr.ecr.<region>.amazonaws.com/<repo>:$SHA1
# Create new Elastic Beanstalk version