website: use user variables in the intro (ec2)

This commit is contained in:
Jack Pearkes 2013-11-25 13:36:32 +01:00
parent 9cabad4704
commit 5c1f9e4cd3
1 changed files with 15 additions and 6 deletions

View File

@ -46,10 +46,14 @@ briefly. Create a file `example.json` and fill it with the following contents:
<pre class="prettyprint"> <pre class="prettyprint">
{ {
"variables": {
"aws_access_key": "",
"aws_secret_key": ""
},
"builders": [{ "builders": [{
"type": "amazon-ebs", "type": "amazon-ebs",
"access_key": "YOUR KEY HERE", "access_key": "{{user `aws_access_key`}}",
"secret_key": "YOUR SECRET KEY HERE", "secret_key": "{{user `aws_secret_key`}}",
"region": "us-east-1", "region": "us-east-1",
"source_ami": "ami-de0d9eb7", "source_ami": "ami-de0d9eb7",
"instance_type": "t1.micro", "instance_type": "t1.micro",
@ -59,9 +63,11 @@ briefly. Create a file `example.json` and fill it with the following contents:
} }
</pre> </pre>
Please fill in the `access_key` and `secret_key` with the proper values When building, you'll pass in the `aws_access_key` and `aws_access_key` as
for your account. Your security credentials can be found on a [user variable](/docs/templates/user-variables.html), keeping your secret
[this page](https://console.aws.amazon.com/iam/home?#security_credential). keys out of the template. You can create security credentials
on [this page](https://console.aws.amazon.com/iam/home?#security_credential).
An example IAM policy document can be found in the [Amazon EC2 builder docs](/docs/builders/amazon.html).
This is a basic template that is ready-to-go. It should be immediately recognizable This is a basic template that is ready-to-go. It should be immediately recognizable
as a normal, basic JSON object. Within the object, the `builders` section as a normal, basic JSON object. Within the object, the `builders` section
@ -106,7 +112,10 @@ should look similar to below. Note that this process typically takes a
few minutes. few minutes.
``` ```
$ packer build example.json $ packer build \
-var 'aws_access_key=YOUR ACCESS KEY' \
-var 'aws_secret_key=YOUR SECRET KEY' \
example.json
==> amazon-ebs: amazon-ebs output will be in this color. ==> amazon-ebs: amazon-ebs output will be in this color.
==> amazon-ebs: Creating temporary keypair for this instance... ==> amazon-ebs: Creating temporary keypair for this instance...