Introduction
This document describes how to add user resource placement script in Amazon Web Services (AWS) cloud for CloudCenter 4.8.2.
Prerequisites
Requirements
Cisco recommends that you have knowledge of these topics:
- Linux
- AWS EC2 Cloud
- Shell scripting
Components Used
The information in this document is based on these software versions:
- CloudCenter version 4.8.2
- CCO (CiscoCloud Orchestrator)
- CCM (CiscoCloud Manager)
- Redhat7 or Centos7
- Repository to store callout script
The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, ensure that you understand the potential impact of any command.
How to Add Resource Placement Script in AWS Cloud?
There are different clouds which CloudCenter supports placing resources according to the user settings. This document focuses on setting resource placement callout script in AWS cloud.
Please follow these steps to place callout scripts for resource placement
Step 1. Login to repository / Linux VM where you can create a bash script for resource placement. If you creat the script in any Linux VM ensure that you copy those file in the repository such that it can be accessed for deploying applications.
Step 2. vi callout.sh and enter the content in the script.
#!/bin/bash
. /utils.sh
print_log "$eNV_imageName"
print_log "$Cloud_Setting_CloudFamily"
print_log "$eNV_parentJobName"
content="{\"vpcId\":\"vpc-31e88948\",
\"subnetId\":\"subnet-44f8bb0c\",
\"securityGroupList\":\"sg-0f05b97b\",
\"vmTagsList\":\"Name:RP_001,PayProfile:Dev,User:AdminUser\",
\"assignPublicIp\":\"true\",
\"nodeInfo\":\"VpcID:vpc-31ee2948, subnetId: subnet-44ftb40c,securityGroupList:sg-0f04b97b \"}"
print_ext_service_result "$content"
Note: Replace VPC ID, subnet, security group, vmTagList, node-info with your information.
All the information can be obtained from the AWS EC2 instance
Step 3. Save the bash script in the repository and change the permission to 755.
Step 4. #chmod 755 callout.sh
Step 5. Once the script is created, you need to enable the resource placement script from CloudCenter Manager.
a. Login to CloudCenter Manager GUI > Environment > New Environment.
b. Click on DEFINE DEFAULTS CLOUD SETTINGS tab.
c. Select Instance type which you wanted your deployment environment to use and Enable Resource Placement, as shown in the image.
d. Once you click on Enable Resource Placement, you get an option to set the Resource Placement Config file, as shown in the image.
Note: Provide the location of the callout.sh, the file that you uploaded to your repository and click on Done tab twice to exit from your Deployment Environment page.
Step 6. Deploy a new instance using the newly created Deployment Environment. Your VM is deployed successfully using the resource placement script created by you.
Tip: You can check the gateway.log files from CCO to verify whether the script is executed successfully or not.
This is the output shown in the log files.
2018-01-09 15:16:14,917 INFO service.LifecycleClusterStartAction [RxCachedThreadScheduler-6] - DeploymentJobID=37 requestNodeCount = 1 , minNodeCount=1 , createdCount = 1
2018-01-09 15:16:16,121 INFO strategy.DockerBaseCallout [threadPoolExecutor-21] - Output from Callout
CLIQR_EXTERNAL_SERVICE_LOG_MSG_START^M
Executing service resourcePlacement action with command: "/opt/remoteFiles/cliqr_local_file/callout.sh" from directory: ^M
CLIQR_EXTERNAL_SERVICE_LOG_MSG_END^M
CLOUD_CENTER_SCRIPT_OUTPUT^M
CLIQR_EXTERNAL_SERVICE_LOG_MSG_START^M
Executing script/command: /opt/remoteFiles/cliqr_local_file/callout.sh.^M
CLIQR_EXTERNAL_SERVICE_LOG_MSG_END^M
CLIQR_EXTERNAL_SERVICE_LOG_MSG_START^M
Ubuntu 14.04^M
CLIQR_EXTERNAL_SERVICE_LOG_MSG_END^M
CLIQR_EXTERNAL_SERVICE_LOG_MSG_START^M
^M
CLIQR_EXTERNAL_SERVICE_LOG_MSG_END^M
CLIQR_EXTERNAL_SERVICE_LOG_MSG_START^M
docker_cluster^M
CLIQR_EXTERNAL_SERVICE_LOG_MSG_END^M
CLIQR_EXTERNAL_SERVICE_RESULT_START^M
{"vpcId":" vpc-31e88948",^M
"subnetId":" subnet-44f8bb0c ",^M
"securityGroupList":" sg-0f05b97b ",^M
"vmTagsList":"Name:RP_001,PayProfile:Dev,User:AdminUser",^M
"assignPublicIp":"true",^M
"nodeInfo":"VpcID: vpc-31e88948, subnetId: subnet-44f8bb0c,securityGroupList: sg-0f05b97b "}^M
CLIQR_EXTERNAL_SERVICE_RESULT_END^M