Created
July 7, 2017 04:26
-
-
Save riyadhalnur/c88f2c77275b194f2fd665af469de951 to your computer and use it in GitHub Desktop.
AWS AMI build config for Packer. Install NodeJS using NVM and the latest version of NPM.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"variables": { | |
"aws_access_key": "", | |
"aws_secret_key": "" | |
}, | |
"builders": [{ | |
"type": "amazon-ebs", | |
"access_key": "{{user `aws_access_key`}}", | |
"secret_key": "{{user `aws_secret_key`}}", | |
"region": "ap-southeast-1", | |
"source_ami_filter": { | |
"filters": { | |
"virtualization-type": "hvm", | |
"image-id": "ami-fc5ae39f" | |
}, | |
"owners": ["137112412989"], | |
"most_recent": true | |
}, | |
"instance_type": "t2.micro", | |
"ssh_username": "ec2-user", | |
"ami_name": "nodejs-machine-{{timestamp}}", | |
"tags": { | |
"name": "nodejs-image" | |
} | |
}], | |
"provisioners": [{ | |
"type": "shell", | |
"inline": [ | |
"sleep 30", | |
"sudo yum update -y", | |
"sudo yum install git make gcc -y", | |
"curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash", | |
"source ~/.bashrc", | |
"nvm install 8", | |
"npm install -g npm@latest" | |
] | |
}] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment