Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Using cloud-init on AWS to Initialize vMX Instances

Starting with Junos OS Release 17.2R1, when you create the vMX instance, you can use cloud-init services on AWS to pass a valid Junos OS configuration file as user data to initialize the vMX instance. The user-data file uses the standard Junos OS syntax to define all the configuration details for your vMX instance. The user-data file cannot exceed 16 KB. If your user-data file exceeds this limit, you must compress the file using gzip and use the compressed file. For example, the gzip junos.conf command results in the junos.conf.gz file.

The configuration must be validated and include details for the fxp0 interface, login, and authentication. It must also have a default route for traffic on fxp0. This information must match the details of the AWS VPC and subnet into which the instance is launched. If any of this information is missing or incorrect, the instance is inaccessible and you must launch a new one.

Note:

The Junos OS configuration that is passed as user data is only imported at initial launch. If the instance is stopped and restarted, the user-data file is not imported again.

To create the user-data file:

  1. Create a file in plaintext with the Junos OS syntax and save it.
    Note:

    The string #junos-config must be the first line of the user-data file before the Junos OS configuration.

  2. (Optional) You can use special tags in the configuration. The following special tags are case-sensitive and are replaced by the corresponding information at run-time.

    Tag

    Replaced With

    FXP0ADDR

    IP address/mask of the first network interface

    GATEWAY

    IP address of the default gateway

    SSHRSAKEY

    SSH public key specified during launch

    HOSTNAME

    Hostname assigned by DHCP to the instance

  3. To specify the user-data file for configuring the vMX instance, select As File in the User data section on the Configure Instance Details page and attach the file. The selected configuration file is used for the initial launch of the instance.

This sample user-data file is the default file that is used when you do not specify a file. It uses the special tags in the configuration.

Release History Table
Release
Description
17.2R1
Starting with Junos OS Release 17.2R1, when you create the vMX instance, you can use cloud-init services on AWS to pass a valid Junos OS configuration file as user data to initialize the vMX instance.