Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- set -ex
- echo "Gathering AWS Credentials..."
- AWS_ACCESS_KEY=$(aws configure get aws_access_key_id --profile=$1)
- AWS_SECRET_KEY=$(aws configure get aws_secret_access_key --profile=$1)
- AWS_REGION=$(aws configure get region --profile=$1)
- AWS_ACCOUNT_ID=$(aws ec2 describe-security-groups --group-names 'Default' --query 'SecurityGroups[0].OwnerId' --output text --profile=$1)
- echo "AWS Account ID: $AWS_ACCOUNT_ID"
- echo "AWS Access Key ID: $AWS_ACCESS_KEY"
- echo "AWS Secret Access Key ID: $AWS_SECRET_KEY"
- echo "AWS Region: $AWS_REGION"
- packer build \
- -var "aws_access_key=$AWS_ACCESS_KEY" \
- -var "aws_secret_key=$AWS_SECRET_KEY" \
- -var "aws_account_id=$AWS_ACCOUNT_ID" \
- -var "aws_region=$AWS_REGION" \
- packer.json
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement