Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save moss2k13/d5b2afbf7f411296d7c15aa4005ca597 to your computer and use it in GitHub Desktop.
Save moss2k13/d5b2afbf7f411296d7c15aa4005ca597 to your computer and use it in GitHub Desktop.
{
"builders": [
{
"name": "custom-emr-ami",
"type": "amazon-ebs",
"skip_region_validation": true,
"ami_name": "{{ user `build_name` }}{{ user `prefix` }}-build{{ user `build_number` }}",
"communicator": "ssh",
"instance_type": "t2.small",
"token": "{{ user `aws_session_token` }}",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "{{ user `aws_region` }}",
"source_ami_filter": {
"filters": {
"name": "amzn2-ami-hvm-{{ user `AmazonOsReleaseLabel` }}-x86_64-gp2",
"root-device-type": "ebs",
"virtualization-type": "hvm"
},
"owners": ["137112412989"]
},
"ssh_interface": "public_dns",
"ssh_username": "hadoop",
"assume_role": {
"role_arn" : "arn:aws:iam::063325037460:role/packer-test-role",
"session_name": "packerwithconditions",
"tags": {
"team": "MYTEAM"
},
"transitive_tag_keys": ["team"]
},
"tags": {
"team": "MYTEAM"
},
"run_tags": {
"team": "MYTEAM"
},
"run_volume_tags": {
"team": "MYTEAM"
},
"snapshot_tags": {
"team": "MYTEAM"
},
"temporary_security_group_source_public_ip": true,
"metadata_options": {
"http_endpoint": "enabled",
"http_tokens": "required",
"http_put_response_hop_limit": 1,
"instance_metadata_tags": "enabled"
},
"launch_block_device_mappings": [
{
"delete_on_termination": true,
"device_name": "/dev/xvda",
"volume_size": 20
}
]
}
],
"provisioners": [
{
"type": "file",
"destination": "/tmp/",
"source": "requirements.txt"
},
{
"type": "shell",
"inline": [
"pip install -r /tmp/requirements.txt"
]
},
],
"variables": {
"prefix": "",
"packerPath": "",
"AmazonOsReleaseLabel": "",
"aws_profile": "{{ env `AWS_PROFILE` }}",
"aws_region": "{{ env `AWS_REGION` }}",
"aws_access_key": "{{ env `AWS_ACCESS_KEY_ID` }}",
"aws_secret_key": "{{ env `AWS_SECRET_ACCESS_KEY` }}",
"aws_session_token": "{{ env `AWS_SESSION_TOKEN` }}",
"build_number": "{{ env `BUILD_BUILDNUMBER` }}",
"build_name": "{{ env `BUILD_DEFINITIONNAME` }}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment