Cloud Provider | AWS |
---|---|
Services | AWS Lambda |
Description | Used to perform the given task using the backend logic. Names of all lambda start with 'cmp'. |
Items/names | cmp_auth, cmp_lander, cmp_fetch_data, cmp_mapper, cmp_config_builder, cmp_engine, cmp_outputs_db, cmp_modify, cmp_backup, cmp_discovery, cmp_cmdb_discovery, cmp_target_delete, cmp_get_handler |
Cloud Provider | AWS |
---|---|
Services | AWS Step functions |
Description | Orchestrates different lambda functions based on the use case |
Items/names | CMP |
Cloud Provider | AWS |
---|---|
Services | AWS S3 |
Description | Contains various essential data such as the engine binary, lambda package, templates, configurations, and outputs |
Items/names | Netalytics-demo |
Cloud Provider | AWS |
---|---|
Services | SSM Parameter store |
Description | It contains some constant data, environment-wise details, and VM image information. All information can be edited by the admin here. |
Items/names | parameter starting with “/cmp/” |
Cloud Provider | AWS |
---|---|
Services | API Gateway |
Description | The entry-point to CMP. Routes the requests from the front-end to the lambda authorizer for authentication purposes. |
Items/names | CMP-API-gateway |
Cloud Provider | AWS |
---|---|
Services | AWS Windows EC2 instance(Domain joined) |
Description | Required to run the scripts inside SSM documents for Cyberark and domain disjoin. |
Items/names | CMP_server |
Cloud Provider | AWS |
---|---|
Services | AWS Systems Manager |
Description | Used to run the script on the EC2 instance |
Items/names | SSM Documents: CMP-cyberark, CMP-disjoin |
Cloud Provider | AZURE |
---|---|
Services | Azure blob storage |
Description | Contains the initial scripts to be run on AZURE VMs. Located in Nextgen environment (servicenow-rg) |
Items/names | cmpscript |
API Details:
CMP API COLLECTION
...
Function
...
Single VM Creation
...
Description
...
To provision a VM in a particular cloud environment based on the configurations described
in the payload. CMDB will be updated on each success case.
...
API
...
https://cmpuat.mphasis.com/Dev/vm/create
...
HTTP Method
...
POST
...
Additional headers
...
"x-api-key": {API-key}
"authorization_token": {auth-token}
...
Payload
{
“doc”: [{
"number": "VM 1",
"sl_no": 1,
"provider": "AZURE",
"OS": "Redhat Enterprise Linux (RHEL)",
"software": "",
"primary_owner": "Meinathan.P01@mphasis.com",
"secondary_owner": "Prakash.Rawat@mphasis.com",
"additional_user":"Meinathan.P01@mphasis.com,Prakash.Rawat@mphasis.com",
"disk_size": "128",
"extra_disk": "50,80",
"instance_type": "Standard_B2s",
"resource_group": "servicenow-rg",
"new_resource_group": "",
"price": "64.266”,
"sysID": "d77dcd24db6e4414218936cb7c9619db",
"resource": "VM",
"requested_by": "netalytics team",
"environment": "Nextgen-RD",
"project_code": "98203",
"request_number": "REQxxxxxx",
"project_name": "CIO_Cloud_CSP",
"application_name": "testappp"
“server_role”: “”,
“cpu”: “”,
“memory”: “”,
“autoshutdown”: “”
}]
}
Response:
{
“status”: “success”,
“Message”: “The request has been approved and is being processed. Further updates will be sent via
E-mail”}
...
Function
...
Multiple VM Creation
...
Description
...
Multi Cloud -Multi VM Provisioning based on the configurations described in the payload.
CMDB will be updated on each success case.
...
API
...
https://cmpuat.mphasis.comDev/vm/create
...
HTTP Method
...
POST
...
Additional headers
...
"x-api-key": {API-key}
"authorization_token": {auth-token}
...
Payload
{
"doc": [ {
"number": "VM 1",
“sl_no": 1,
"provider": "AZURE",
"OS": "Redhat Enterprise Linux (RHEL)",
"software": "",
"primary_owner": "Meinathan.P01@mphasis.com",
"secondary_owner": "Prakash.Rawat@mphasis.com",
"additional_user":"Meinathan.P01@mphasis.com,Prakash.Rawat@mphasis.com",
"disk_size": "128",
"extra_disk": "50,80",
"instance_type": "Standard_B2s",
"resource_group": "servicenow-rg",
"new_resource_group": "",
"price": "64.266”,
"sysID": "d77dcd24db6e4414218936cb7c9619db",
"resource": "VM",
"requested_by": "netalytics team",
"environment": "Nextgen-RD",
"project_code": "98203",
"request_number": "REQxxxxxx",
"project_name": "CIO_Cloud_CSP",
"application_name": "testappp"
“server_role”: “”,
“cpu”: “”,
“memory”: “”,
“autoshutdown”: “”
},
{
"number": "VM 2",
“sl_no": 2,
"provider": "AZURE",
"OS": "Redhat Enterprise Linux (RHEL)",
"software": "",
"primary_owner": "Meinathan.P01@mphasis.com",
"secondary_owner": "Prakash.Rawat@mphasis.com",
"additional_user":"Meinathan.P01@mphasis.com,Prakash.Rawat@mphasis.com",
"disk_size": "128",
"extra_disk": "50,80",
"instance_type": "Standard_B2s",
"resource_group": "servicenow-rg",
"new_resource_group": "",
"price": "64.266”,
"sysID": "d77dcd24db6e4414218936cb7c9619db",
"resource": "VM",
"requested_by": "netalytics team",
"environment": "Nextgen-RD",
"project_code": "98203",
"request_number": "REQxxxxxx",
"project_name": "CIO_Cloud_CSP",
"application_name": "testappp"
“server_role”: “”,
“cpu”: “”,
“memory”: “”,
“autoshutdown”: “”
},
{
"number": "VM 3",
“sl_no": 3,
"provider": "AZURE",
...
CMP Resource Settings and Config:
Lambda Settings:
Step 1:Execution role: cmp_lambda_role
Step 2:
Basic settings and other configurations of each lambda:
Step 1:cmp_auth:
Step 2:
cmp_lander:
Step 1:
Step 2:
cmp_fetch_data:
Step 1:
Step 2:
cmp_mapper:
Step 1:
Step 2:
cmp_config_builder:
Step 1:
Step 2:
cmp_engine:
Step 1:
Step 2:
cmp_outputs_db:
Step 1:
Step 2:
cmp_get_handler:
Step 1:
Step 2:
cmp_backup:
Step 1:
Step 2:
cmp_modify:
Step 1:
Step 2:
cmp_cmdb_discovery:
Step 1:
Step 2:
cmp_discovery:
Step 1:
Step 2:
cmp_target_delete:
Step 1:
Step 2:
Step Functions:
Name | CMP |
---|---|
Execution role | cmp_step_function_role |
ARN of all newly created lambdas to be configured in the json definition of the state machine. |
AWS S3:
Name | netalytics-demo |
---|---|
API Gateway:
Name | CMP-API-gateway |
---|---|
The resources and methods should be recreated with the appropriate lambda endpoints. A new set of keys and usage plans to be created. New keys must be updated in the SSM parameter store and also to be shared with the ServiceNow team. |
Azure Blob Storage:
Name | cmpscript |
---|---|
VM created in any environment must have access to this storage so that the initial scripts can be run. | |
API Details:
CMP API COLLECTION
Function | Single VM Creation |
---|---|
Description | To provision a VM in a particular cloud environment based on the configurations described in the payload. CMDB will be updated on each success case. |
API | |
HTTP Method | POST |
Additional headers | "x-api-key": {API-key} "authorization_token": {auth-token} |
Payload |
|
Response | { “status”: “success”, “Message”: “The request has been approved and is being processed. Further updates will be sent via E-mail”} |
Function | Multiple VM Creation |
---|---|
Description | Multi Cloud -Multi VM Provisioning based on the configurations described in the payload. CMDB will be updated on each success case. |
API | |
HTTP Method | POST |
Additional headers | "x-api-key": {API-key} "authorization_token": {auth-token} |
Payload |
|
...
Response
...
{
“status”: “success”,
“Message”: “The request has been approved and is being processed. Further updates will be sent via
e-mail”
}
...
Function
...
Modify VM
...
Description
...
To modify VM configurations. CMDB will be updated on each success case
...
Functionality
...
Modify instance type(upgrade/ Degrade), upgrade disk size, add new discs
...
API
...
disks.https://cmpuat.mphasis.com/Dev/vm/update
...
HTTP Method
...
POST
...
Additional headers
...
"x-api-key": {API-key}
"authorization_token": {auth-token}
...
Payload
{
"doc": [ {
"resource":"VM",
"provider": "AZURE",
"environment": "Nextgen-RD",
"project_code": "98203",
"project_name": "CIO",
"hostname": "SRVAZUCHETES550",
"ip_address": "10.14.48.34",
"update_actions": ["compute_size"],
"new_instance_type": "Standard_B2s",
“Proposed_cpu”: “2”,
“Proposed_ram”: “4”,
"Propose_disk_list": "10,20",
...
|
}
|
...
}]
}
...
Response
...
{
“status”: “success”,
“Message”: “The request has been approved and is being processed. Further updates will be sent via email”
}
...
Payload Key Details
...
provider: Azure/AWS
environment: same environment options as available in single vm form
hostname: hostname of the VM to be upgraded
ip_address: private ip address of the VM to be upgraded
resource_group: Must be sent if the VM to be upgraded is in Azure. If not in Azure, send as an empty
string - ””.
update_actions: This specifies the type of upgrade. Must be passed in list of string format.
Possible values: compute_size (for modifying the instance_type of a vm)
data_disk_add: to add an additional disk
upgrade_disk: To upgrade an existing disk
For Instance, if u need to update both compute size and upgrade an existing disk you
have to pass values in the following manner:
"update_actions": ["compute_size","upgrade_disk"]
new_instance_type: New instance type which the user has selected
new_disk_list: must be a string with comma-separated sizes of new disks
Propose_disk_list: must be a string with comma-separated sizes of new disks
request_number: Ticket number
Note:
if no new disk to be added then new_disk_list value must be an empty string ("").
If no upgrade is required for any of the existing disk, you can send an empty string for Propose_disk_list.
If an upgrade is required then Propose_disk_list must have the disks in correct order with new size.
For Intance: existing disks of a vm: "10,20,30"
If the user wants to change disk2 size from 20 to 50 then, Propose_disk_list value will be: "10,50,30"
...
Function
...
VM Decommission
...
Description
...
| |
Response | { “status”: “success”, “Message”: “The request has been approved and is being processed. Further updates will be sent via e-mail” } |
Function | Modify VM |
---|---|
Description | To modify VM configurations. CMDB will be updated on each success case |
Functionality |
...
Modify instance type(upgrade/ Degrade), upgrade disk size, add new discs | |
API |
...
update | |
HTTP Method | POST |
Additional headers | "x-api-key": {API-key} "authorization_token": {auth-token} |
Payload |
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
Response |
...
backup (boolean): true | false - true if backup is required else false.
backup_disk_ids (list/array): [<disk_ids>] - list of disk IDs which the user wants to backup
retention (number): 1 | 3 | 6 | 12 - backup retention period in months
...
Response
...
{
“status”: “success”,
“Message”: “The request has been approved and is being processed. Further updates will be sent via
email”
}
...
Function
...
Retry
...
Description
...
When clicked failed VM to be initiated to create
...
Functionality
...
Retry function for both Single and Multiple VM
...
Payload
{
“doc”: [{
“retry”: “true”
"number": "VM 1",
"sl_no": 1,
"provider": "AZURE",
"OS": "Redhat Enterprise Linux (RHEL)",
"software": "",
"primary_owner": "Meinathan.P01@mphasis.com",
"secondary_owner": "Prakash.Rawat@mphasis.com",
"additional_user":"Meinathan.P01@mphasis.com,Prakash.Rawat@mphasis.com",
"disk_size": "128",
"extra_disk": "50,80",
"instance_type": "Standard_B2s",
"resource_group": "servicenow-rg",
"new_resource_group": "",
"price": "64.266”,
"sysID": "d77dcd24db6e4414218936cb7c9619db",
"resource": "VM",
"requested_by": "netalytics team",
"environment": "Nextgen-RD",
"project_code": "98203",
...
{ “status”: “success”, “Message”: “The request has been approved and is being processed. Further updates will be sent via email” } | |
Payload Key Details |
string - ””.
Possible values: compute_size (for modifying the instance_type of a vm) data_disk_add: to add an additional disk upgrade_disk: To upgrade an existing disk For Instance, if u need to update both compute size and upgrade an existing disk you have to pass values in the following manner: "update_actions": ["compute_size","upgrade_disk"]
|
Note:
For Intance: existing disks of a vm: "10,20,30" If the user wants to change disk2 size from 20 to 50 then, Propose_disk_list value will be: "10,50,30" |
Function | VM Decommission |
---|---|
Description | To delete a VM and its sub-resources. CMDB will be updated on each success case |
Functionality | Backup, Retention, Disjoin domain, Destroy VM |
API | |
HTTP Method | POST |
Additional headers | "x-api-key": {API-key} "authorization_token": {auth-token} |
Payload |
|
...
|
...
|
...
|
...
|
...
|
...
“cpu”: “”,
“memory”: “”,
...
|
Function | Azure Resource group data discovery |
---|---|
Description | To fetch all resource group data from each environment in the Azure cloud. Created for ServiceNow to fetch the data and populate in the user form |
API | |
HTTP METHOD | GET |
Additional headers | "x-api-key": {API-key} "authorization_token": {auth-token} |
Query parameters | None |
Response | Resource group data (name, project name, project code, primary owner, secondary owner) for each environment in JSON format. { “uat”: [ {....}, {....}....,{....}], “nextgen-rd”: [ {....}, {....}....,{....}],......} |
Note: For now this API will provide data for only DEV/UAT and Nextgen-RD environment as we don't have access to other environments as of now. |
...
Function
...
Resource name-based Discovery
...
Description
To fetch the current VM size and disk details of a VM which already exist in CMDB from the
...
Payload Key Details | backup (boolean): true | false - true if backup is required else false. backup_disk_ids (list/array): [<disk_ids>] - list of disk IDs which the user wants to backup retention (number): 1 | 3 | 6 | 12 - backup retention period in months |
Response | { “status”: “success”, “Message”: “The request has been approved and is being processed. Further updates will be sent via email” } |
Function | Retry |
---|---|
Description | When clicked failed VM to be initiated to create |
Functionality | Retry function for both Single and Multiple VM |
Payload |
|
Function | Azure Resource group data discovery |
---|---|
Description | To fetch all resource group data from each environment in the Azure cloud. Created for ServiceNow to fetch the data and populate in the user form |
API | |
HTTP METHOD | GET |
Additional headers | "x-api-key": {API-key} "authorization_token": {auth-token} |
Query parameters | None |
Response | Resource group data (name, project name, project code, primary owner, secondary owner) for each environment in JSON format. { “uat”: [ {....}, {....}....,{....}], “nextgen-rd”: [ {....}, {....}....,{....}],......} |
Note: For now this API will provide data for only DEV/UAT and Nextgen-RD environment as we don't have access to other environments as of now. |
Function | Resource name-based Discovery |
---|---|
Description | To fetch the current VM size and disk details of a VM which already exist in CMDB from the cloud and post it back to CMDB. |
API | |
HTTP METHOD | GET |
Additional headers | "x-api-key": {API-key} "authorization_token": {auth-token} |
Query parameters | provider - AWS | AZURE environment - Nextgen-RD | UAT | DEV.. etc resource_name - The hostname of the VM |
Example: { 'environment': 'UAT', 'provider': 'AZURE', 'resource_name': 'SRVAZUCHEAZV032’ } |
Function | To delete a disk Snapshot |
---|---|
Description | This api can be used to delete a disk snapshot after backup retention period expires. |
API |
...
HTTP METHOD
...
GET
...
Additional headers
...
"x-api-key": {API-key}
"authorization_token": {auth-token}
...
Query parameters
...
provider - AWS | AZURE
environment - Nextgen-RD | UAT | DEV.. etc
resource_name - The hostname of the VM
Example:
GET method on https://cmpuat.mphasis.com/Dev/discovery/vm with the query parameters :
{
'environment': 'UAT',
'provider': 'AZURE',
'resource_name': 'SRVAZUCHEAZV032’
...
HTTP Method | POST |
Payload |
|
Response | { "status": "<success or failure>", "message": "<status-message>" }
example payload and response: { "provider": "AWS", "environment": "UAT", "snapshot_id": "snap-0f20b675f9cb56ce9" } response: { "status": "success", "message": "Successfully deleted Snapshot: snap-0f20b675f9cb56ce9" } |
NOTE: The snapshot_id should be a valid snapshot ID and the trigger should be sent only after the retention period expires. |