2017-09-11 09:56:11 -07:00
---
2018-02-02 12:19:04 -08:00
description: |
2017-09-12 16:30:39 +01:00
The oracle-oci builder is able to create new custom images for use with Oracle
Cloud Infrastructure (OCI).
2017-09-11 09:56:11 -07:00
layout: docs
2017-09-12 16:30:39 +01:00
page_title: 'Oracle OCI - Builders'
sidebar_current: 'docs-builders-oracle-oci'
2017-02-13 10:35:14 +00:00
---
2017-09-12 16:30:39 +01:00
# Oracle Cloud Infrastructure (OCI) Builder
2017-02-13 10:35:14 +00:00
2017-09-12 16:30:39 +01:00
Type: `oracle-oci`
2017-02-13 10:35:14 +00:00
2017-09-12 16:30:39 +01:00
The `oracle-oci` Packer builder is able to create new custom images for use
with [Oracle Cloud Infrastructure ](https://cloud.oracle.com ) (OCI). The builder
takes a base image, runs any provisioning necessary on the base image after
launching it, and finally snapshots it creating a reusable custom image.
2017-02-13 10:35:14 +00:00
It is recommended that you familiarise yourself with the
[Key Concepts and Terminology ](https://docs.us-phoenix-1.oraclecloud.com/Content/GSG/Concepts/concepts.htm )
prior to using this builder if you have not done so already.
2017-08-02 12:30:03 +01:00
The builder _does not_ manage images. Once it creates an image, it is up to you
2017-02-13 10:35:14 +00:00
to use it or delete it.
## Authorization
2017-09-12 16:30:39 +01:00
The Oracle OCI API requires that requests be signed with the RSA public key
2017-02-13 10:35:14 +00:00
associated with your [IAM ](https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm )
user account. For a comprehensive example of how to configure the required
authentication see the documentation on
[Required Keys and OCIDs ](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm )
([Oracle Cloud IDs ](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm )).
## Configuration Reference
2017-09-12 16:30:39 +01:00
There are many configuration options available for the `oracle-oci` builder.
2017-02-13 10:35:14 +00:00
In addition to the options listed here, a
[communicator ](/docs/templates/communicator.html ) can be configured for this
builder.
2017-08-02 12:30:03 +01:00
### Required
2017-02-13 10:35:14 +00:00
- `availability_domain` (string) - The name of the
[Availability Domain ](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm )
within which a new instance is launched and provisioned.
The names of the Availability Domains have a prefix that is specific to
your [tenancy ](https://docs.us-phoenix-1.oraclecloud.com/Content/GSG/Concepts/concepts.htm#two ).
To get a list of the Availability Domains, use the
[ListAvailabilityDomains ](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/latest/AvailabilityDomain/ListAvailabilityDomains )
operation, which is available in the IAM Service API.
2017-09-12 16:30:39 +01:00
- `base_image_ocid` (string) - The OCID of the [base image ](https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/References/images.htm )
2017-02-13 10:35:14 +00:00
to use. This is the unique identifier of the image that will be used to
launch a new instance and provision it.
To get a list of the accepted image OCIDs, use the
[ListImages ](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/latest/Image/ListImages )
operation available in the Core Services API.
- `compartment_ocid` (string) - The OCID of the
[compartment ](https://docs.us-phoenix-1.oraclecloud.com/Content/GSG/Tasks/choosingcompartments.htm )
2017-09-12 16:30:39 +01:00
- `fingerprint` (string) - Fingerprint for the OCI API signing key.
2017-08-02 17:18:53 +01:00
Overrides value provided by the
2017-09-12 16:30:39 +01:00
[OCI config file ](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm )
2017-02-13 10:35:14 +00:00
if present.
- `shape` (string) - The template that determines the number of
CPUs, amount of memory, and other resources allocated to a newly created
instance.
To get a list of the available shapes, use the
[ListShapes ](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Shape/ListShapes )
operation available in the Core Services API.
- `subnet_ocid` (string) - The name of the subnet within which a new instance
is launched and provisioned.
To get a list of your subnets, use the
[ListSubnets ](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/latest/Subnet/ListSubnets )
operation available in the Core Services API.
2017-03-23 11:51:12 +00:00
Note: the subnet must be configured to allow access via your chosen
[communicator ](/docs/templates/communicator.html ) (communicator defaults to
[SSH tcp/22 ](/docs/templates/communicator.html#ssh_port )).
2017-08-02 12:30:03 +01:00
### Optional
- `access_cfg_file` (string) - The path to the
2017-09-12 16:30:39 +01:00
[OCI config file ](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm ).
Defaults to `$HOME/.oci/config` .
2017-08-02 12:30:03 +01:00
- `access_cfg_file_account` (string) - The specific account in the
2017-09-12 16:30:39 +01:00
[OCI config file ](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm )
2017-08-02 12:30:03 +01:00
to use. Defaults to `DEFAULT` .
- `image_name` (string) - The name to assign to the resulting custom image.
2017-09-12 16:30:39 +01:00
- `key_file` (string) - Full path and filename of the OCI API signing key.
2017-08-02 17:18:53 +01:00
Overrides value provided by the
2017-09-12 16:30:39 +01:00
[OCI config file ](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm )
2017-08-02 12:30:03 +01:00
if present.
2017-09-12 16:30:39 +01:00
- `pass_phrase` (string) - Pass phrase used to decrypt the OCI API signing
2017-08-02 17:18:53 +01:00
key. Overrides value provided by the
2017-09-12 16:30:39 +01:00
[OCI config file ](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm )
2017-08-02 12:30:03 +01:00
if present.
2017-09-12 16:30:39 +01:00
- `region` (string) - An Oracle Cloud Infrastructure region. Overrides
2017-08-02 12:30:03 +01:00
value provided by the
2017-09-12 16:30:39 +01:00
[OCI config file ](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm )
2017-08-02 12:30:03 +01:00
if present.
2017-02-13 10:35:14 +00:00
- `tenancy_ocid` (string) - The OCID of your tenancy. Overrides value provided
by the
2017-09-12 16:30:39 +01:00
[OCI config file ](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm )
2017-02-13 10:35:14 +00:00
if present.
2017-09-12 16:30:39 +01:00
- `user_ocid` (string) - The OCID of the user calling the OCI API. Overrides
value provided by the [OCI config file ](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm )
2017-02-13 10:35:14 +00:00
if present.
2018-02-13 14:41:51 +01:00
- `use_private_ip` (boolean) - Use private ip addresses to connect to the instance via ssh.
2018-07-17 17:41:19 +02:00
- `metadata` (map of strings) - Metadata optionally contains custom metadata key/value pairs provided in the
configuration. While this can be used to set metadata["user_data"] the explicit "user_data" and "user_data_file" values will have precedence. An instance's metadata can be obtained from at http://169.254.169.254 on the
launched instance.
2018-07-02 10:48:08 +02:00
2018-03-30 10:57:40 -07:00
- `user_data` (string) - user_data to be used by cloud
init. See [the Oracle docs ](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/LaunchInstanceDetails ) for more details. Generally speaking, it is easier to use the `user_data_file` ,
2018-07-17 17:44:27 +02:00
but you can use this option to put either the plaintext data or the base64
2018-03-30 10:57:40 -07:00
encoded data directly into your Packer config.
- `user_data_file` (string) - Path to a file to be used as user_data by cloud
init. See [the Oracle docs ](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/LaunchInstanceDetails ) for more details. Example:
`"user_data_file": "./boot_config/myscript.sh"`
2017-02-13 10:35:14 +00:00
## Basic Example
Here is a basic example. Note that account specific configuration has been
substituted with the letter `a` and OCIDS have been shortened for brevity.
2017-09-11 09:56:11 -07:00
``` {.json}
2017-02-13 10:35:14 +00:00
{
2017-09-11 09:56:11 -07:00
"availability_domain": "aaaa:PHX-AD-1",
"base_image_ocid": "ocid1.image.oc1.phx.aaaaaaaa5yu6pw3riqtuhxzov7fdngi4tsteganmao54nq3pyxu3hxcuzmoa",
"compartment_ocid": "ocid1.compartment.oc1..aaa",
"image_name": "ExampleImage",
"shape": "VM.Standard1.1",
"ssh_username": "opc",
"subnet_ocid": "ocid1.subnet.oc1..aaa",
2017-09-12 16:30:39 +01:00
"type": "oracle-oci"
2017-02-13 10:35:14 +00:00
}
```