- 18 Oct 2024
-
DarkLight
-
PDF
Provision VPC and EC2 Instance (AWS) - Workflow
- Updated on 18 Oct 2024
-
DarkLight
-
PDF
Now that we’ve reviewed our Pre-Builts, we’re ready to put things together in our workflow.
Workflow Video (Part 1)
Step 1
From the Automation Studio dashboard, click the plus at the top of the left navigation panel.
Step 2
Select Workflow from the dropdown list. Name it Provision VPC and EC2 Instance-AWS-XX (XX Represents your initials). Click Create.
Step 3
A fresh workflow canvas opens. In this use case, we would like to build our workflow horizontally, so we will click and drag our Terminator tasks so they are aligned horizontally.
Step 4
Enter Transformation into the Search box of the Task Palette. The JSON Transformation task appears.
Step 5
This workflow will use 3 Transformation tasks. Add the first Transformation task by clicking and dragging the task from the Task Palette onto the canvas. Place the first Transformation task to the right of the Start task.
Step 6
Add a second Transformation task to the canvas. Place the task to the right of the first Transformation task, leaving space to add another task in between them.
Step 7
Add a third Transformation task to the canvas. Place the task to the right of the second Transformation task, again leaving space to add another task in between. You will also want to allow space after the Transformation task for an additional task between it and the End termination task.
Step 8
Next, you will add a pair of Child Job tasks to the canvas by entering Child Job in the Task Palette search box. Add the first Child Job task to the canvas and place it between the first and second Transformation tasks. Add a second Child Job task to the canvas and place it between the second and third Transformation tasks.
Step 9
The final task you will add, is the View Data task. Search for the task and then add it to the canvas, placing it between the third Transformation task and the End task. Once all tasks have been added, the Task Palette can be closed.
Step 10
The next step is to add transitions, which will connect the tasks together to form the workflow. This is done by first clicking the task you want to transition from, which will highlight the task with a dashed border. Click within the dashed border and begin dragging the transitions toward the destination task. When the transition snaps to the destination task, release the mouse button.
Note: The default transition is a Success transition. If you would like to add an Error or a Failure transition, press and hold the E or the F key on your keyboard as you are adding the transition. You can also right click an existing transition and a pop-up will allow you to change the transition type or delete the transition.
Step 11
Repeat this process to add the remaining transitions until your workflow looks like the image shown in the video.
Workflow Video (Part 2)
Step 12
Now that the tasks have been added to our canvas and connected with transitions, we will begin configuring each task, starting with the first Transformation task. Double click the Transformation task to configure it.
Step 13
Type Process AWS in the Transformation Name field and select Process AWS Form Data JST. The purpose of the Transformation task is to extract the individual values from the submitted form.
Step 14
By changing the Variable Source for formData of the Incoming Schema from static to job, we are configuring the Transformation task to source the data from the form inputs submitted to the workflow, rather than static inputs. Ensure formData appears in the Job Variable field and click Save.
Close the Transformation task.
Step 15
Double click the first Child Job task to configure it.
Step 16
Navigate to the Details tab and enter Create VPC with Networking for the Summary and Create VPC with Networking using Itential Pre-Built for the Description.
Step 17
Returning to the Data tab, you will need to find the workflow that will be used by the Child Job task. To filter the list, enter Provision and then select the Provision VPC with Networking – AWS workflow.
Step 18
The default variables appear below in the Job Variables section. Scrolling down, we see the Variable Source for each job variable defaulted to Process AWS Form Data JST from the previous task so we do not need to make changes to the variable source.
Step 19
Notice the Task Variable for each Job Variable defaulted to vpcSubnet. We can keep this value for the vpcSubnet Task Variable, however the others will need to be changed. For the vpcName variable, use the Task Variable dropdown to select vpcName
Step 20
For the securityGroupName Variable select securityGroupName. For the securityGroupDesc Variable select securityGroupDesk and for the ingressRules Variable Variable select ingressRules.
Step 21
Double click the second Transformation task to configure it.
Step 22
Type Build EC2 in the Transformation Name field and select Build EC2 Creation Data JST.
Step 23
We would like the Transformation task to use the incoming data from the first Child Job task. Change the Variable Source from Static to Task. Ensure the previous task, Create VPC with Networking is selected. Also verify that the Task Variable defaulted to job_details. Close the Transformation task.
Step 24
Double click the second Child Job task to configure it.
Step 25
Navigate to the Details tab and enter Create EC2 Instance for the Summary and Create EC2 Instance using Itential Pre-Built for the Description.
Step 26
Return to the Data tab and select Create EC2 Instance – AWS from the dropdown. The Input Job Variables for the workflow will populate. For these job variables, we will use a combination of two different Variable Sources.
Step 27
For the imageId Variable select Process AWS Form Data JST for the Variable Source and image for the Variable Value. For the instanceType Variable select Process AWS Form Data JST for the Variable Source and size for the Variable Value.
Configure the Job Variables so that each Task Variable matches the Variable Source and Value shown in the table. When you are finished, close the Child Job task.
Step 28
For the securityGroupId Variable select Build EC2 Creation Data JST for the Variable Source and securityGroupId for the Variable Value. For the networkInterface Variable select Build EC2 Creation Data JST for the Variable Source and networkinterface for the Variable Value. For the vpcName Variable select Process AWS Form Data JST for the Variable Source and vpcName for the Variable Value. Close the Child Job task.
Step 29
Double click the third Transformation task to configure it.
Step 30
Select Generate Completion Message JST in the Transformation field.
Step 31
We would like the Transformation task to use the incoming data from the second Child Job task. Change the Variable Source from Static to Task. Ensure the previous task, Create EC2 Instance, is selected. Also verify that the Task Variable defaulted to job_details. Close the Transformation task.
Step 32
Double click the View Data task to configure it.
Step 32
On the Details tab, enter Web Server Ready for both the Summary and the Description.
Step 33
Returning to the Data tab, locate the message Input Variable, and change the Variable Source from Static to Task. Select Generate Completion Message JST for the Task and message for the Task Variable.
Step 34
The remaining Input Variables should all be set to static and their static inputs should be set as follows:
Input Variable | Value |
header | Web Server Ready |
body | (leave blank) |
variables | (leave blank) |
btn_success | OK |
btn_failure | (leave blank) |
Step 35
Once all Input Variables have been populated, close the View Data task and Save the workflow.
Step 36
Click the ▶ icon to open the Run Workflow window.
Step 37
Set Job Variables shows the variables the workflow requires to run. This workflow expects to receive one variable, formData, which will be passed in from Operations Manager, which we will cover next.
The Run button will run the workflow, but we are only testing it to confirm the inputs.
Click the Cancel button.