add basic aws examples
This commit is contained in:
parent
415a9c47b6
commit
b12bc5d122
|
@ -110,6 +110,11 @@ Block devices can be nested in the
|
|||
|
||||
Here is a basic example. It is completely valid except for the access keys:
|
||||
|
||||
|
||||
|
||||
<Tabs>
|
||||
<Tab heading="JSON">
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "amazon-chroot",
|
||||
|
@ -120,6 +125,34 @@ Here is a basic example. It is completely valid except for the access keys:
|
|||
}
|
||||
```
|
||||
|
||||
</Tab>
|
||||
<Tab heading="HCL2">
|
||||
|
||||
```hcl
|
||||
variable "aws_access_key" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "aws_secret_key" {
|
||||
type = string
|
||||
}
|
||||
|
||||
source "amazon-chroot" "basic-example" {
|
||||
access_key = var.aws_access_key
|
||||
secret_key = var.aws_secret_key
|
||||
source_ami = "ami-e81d5881"
|
||||
}
|
||||
|
||||
build {
|
||||
source "sources.amazon-chroot.basic-example" {
|
||||
ami_name = "packer-amazon-chroot {{timestamp}}"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
## Chroot Mounts
|
||||
|
||||
The `chroot_mounts` configuration can be used to mount specific devices within
|
||||
|
|
|
@ -107,6 +107,9 @@ Here is a basic example. You will need to provide access keys, and may need to
|
|||
change the AMI IDs according to what images exist at the time the template is
|
||||
run:
|
||||
|
||||
<Tabs>
|
||||
<Tab heading="JSON">
|
||||
|
||||
```json
|
||||
{
|
||||
"variables": {
|
||||
|
@ -128,6 +131,37 @@ run:
|
|||
}
|
||||
```
|
||||
|
||||
</Tab>
|
||||
<Tab heading="HCL2">
|
||||
|
||||
```hcl
|
||||
variable "aws_access_key" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "aws_secret_key" {
|
||||
type = string
|
||||
}
|
||||
|
||||
source "amazon-ebs" "basic-example" {
|
||||
access_key = var.aws_access_key
|
||||
secret_key = var.aws_secret_key
|
||||
region = "us-east-1"
|
||||
source_ami = "ami-fce3c696"
|
||||
instance_type = "t2.micro"
|
||||
ssh_username = "ubuntu"
|
||||
}
|
||||
|
||||
build {
|
||||
source "sources.amazon-ebs.basic-example" {
|
||||
ami_name = "packer_AWS {{timestamp}}"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
-> **Note:** Packer can also read the access key and secret access key from
|
||||
environmental variables. See the configuration reference in the section above
|
||||
for more information on what environmental variables Packer will look for.
|
||||
|
|
|
@ -102,6 +102,10 @@ Block devices can be nested in the
|
|||
|
||||
## Basic Example
|
||||
|
||||
|
||||
<Tabs>
|
||||
<Tab heading="JSON">
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "amazon-ebssurrogate",
|
||||
|
@ -129,6 +133,46 @@ Block devices can be nested in the
|
|||
}
|
||||
```
|
||||
|
||||
</Tab>
|
||||
<Tab heading="HCL2">
|
||||
|
||||
```hcl
|
||||
source "amazon-ebssurrogate" "basic-example" {
|
||||
region = "us-east-1"
|
||||
ssh_username = "ubuntu"
|
||||
instance_type = "t2.medium"
|
||||
source_ami = "ami-40d28157"
|
||||
ami_name = "packer-test-adrien"
|
||||
ami_virtualization_type = "paravirtual"
|
||||
|
||||
launch_block_device_mappings {
|
||||
volume_type = "gp2"
|
||||
device_name = "/dev/xvdf"
|
||||
delete_on_termination = false
|
||||
volume_size = 10
|
||||
}
|
||||
|
||||
ami_root_device {
|
||||
source_device_name = "/dev/xvdf"
|
||||
device_name = "/dev/xvda"
|
||||
delete_on_termination = true
|
||||
volume_size = 16
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
|
||||
build {
|
||||
sources = ["sources.amazon-ebssurrogate.basic-example"]
|
||||
|
||||
provisioner "shell" {
|
||||
inline = ["..."]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
-> **Note:** Packer can also read the access key and secret access key from
|
||||
environmental variables. See the configuration reference in the section above
|
||||
for more information on what environmental variables Packer will look for.
|
||||
|
|
|
@ -106,11 +106,12 @@ Block devices can be nested in the
|
|||
|
||||
## Basic Example
|
||||
|
||||
<Tabs>
|
||||
<Tab heading="JSON">
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "amazon-ebsvolume",
|
||||
"secret_key": "YOUR SECRET KEY HERE",
|
||||
"access_key": "YOUR KEY HERE",
|
||||
"region": "us-east-1",
|
||||
"ssh_username": "ubuntu",
|
||||
"instance_type": "t2.medium",
|
||||
|
@ -150,6 +151,58 @@ Block devices can be nested in the
|
|||
}
|
||||
```
|
||||
|
||||
</Tab>
|
||||
<Tab heading="HCL2">
|
||||
|
||||
```hcl
|
||||
source "amazon-ebsvolume" "basic-example" {
|
||||
region = "us-east-1"
|
||||
ssh_username = "ubuntu"
|
||||
instance_type = "t2.medium"
|
||||
source_ami = "ami-40d28157"
|
||||
|
||||
ebs_volumes {
|
||||
volume_type = "gp2"
|
||||
device_name = "/dev/xvdf"
|
||||
delete_on_termination = false
|
||||
tags = {
|
||||
zpool = "data"
|
||||
Name = "Data1"
|
||||
}
|
||||
volume_size = 10
|
||||
}
|
||||
|
||||
ebs_volumes {
|
||||
volume_type = "gp2"
|
||||
device_name = "/dev/xvdg"
|
||||
tags = {
|
||||
zpool = "data"
|
||||
Name = "Data2"
|
||||
}
|
||||
delete_on_termination = false
|
||||
volume_size = 10
|
||||
}
|
||||
|
||||
ebs_volumes {
|
||||
volume_size = 10
|
||||
tags = {
|
||||
zpool = "data"
|
||||
Name = "Data3"
|
||||
}
|
||||
delete_on_termination = false
|
||||
device_name = "/dev/xvdh"
|
||||
volume_type = "gp2"
|
||||
}
|
||||
}
|
||||
|
||||
build {
|
||||
sources = ["sources.amazon-ebsvolume.basic-example"]
|
||||
}
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
-> **Note:** Packer can also read the access key and secret access key from
|
||||
environmental variables. See the configuration reference in the section above
|
||||
for more information on what environmental variables Packer will look for.
|
||||
|
|
|
@ -121,6 +121,9 @@ Block devices can be nested in the
|
|||
|
||||
Here is a basic example. It is completely valid except for the access keys:
|
||||
|
||||
<Tabs>
|
||||
<Tab heading="JSON">
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "amazon-instance",
|
||||
|
@ -141,6 +144,33 @@ Here is a basic example. It is completely valid except for the access keys:
|
|||
}
|
||||
```
|
||||
|
||||
</Tab>
|
||||
<Tab heading="HCL2">
|
||||
|
||||
```hcl
|
||||
source "amazon-instance" "basic-example" {
|
||||
region = "us-east-1"
|
||||
source_ami = "ami-d9d6a6b0"
|
||||
instance_type = "m1.small"
|
||||
ssh_username = "ubuntu"
|
||||
|
||||
account_id = "0123-4567-0890"
|
||||
s3_bucket = "packer-images"
|
||||
x509_cert_path = "x509.cert"
|
||||
x509_key_path = "x509.key"
|
||||
x509_upload_path = "/tmp"
|
||||
}
|
||||
|
||||
build {
|
||||
source "sources.amazon-instance.basic-example" {
|
||||
ami_name = "packer-quick-start {{timestamp}}"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
-> **Note:** Packer can also read the access key and secret access key from
|
||||
environmental variables. See the configuration reference in the section above
|
||||
for more information on what environmental variables Packer will look for.
|
||||
|
|
Loading…
Reference in New Issue