Am trying to create an AWS VM using HTTP Query API from Cisco Process Orchestrator(Tidal Enterprise Orchestrator). The Query parameter "UserData" to be sent is of nearly 30 lines. When i try to calculate the signature for AWS using the powershell command, it runs for nearly an hour without any output. But when i reduce my Userdata to around 8 lines, the signature is calculated perfectly. The script i use to calculate the signature is given below,
$secret, $data, $awshost = $args
[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
$params = $data.replace("%%","%")
$verb = "POST"
$url = "/"
$data = [String]::Format("{0}`n{1}`n{2}`n{3}", $verb, $awshost, $url, $params)
$encoder = New-Object System.Text.UTF8Encoding
$sha256 = New-Object System.Security.Cryptography.HMACSHA256
$sha256.Key = $encoder.GetBytes($secret)
$hmac = $sha256.ComputeHash($encoder.GetBytes($data))
$enc = [System.Convert]::ToBase64String($hmac)
$hash = [System.Uri]::EscapeDataString($enc)
$null = [Reflection.Assembly]::LoadWithPartialName("System.Web")
$hash = [System.Web.HttpUtility]::UrlEncode($enc)
$hash.toString()
Can anyone please suggest how to make the command run faster with large data? I tried running the commands in my local windows powershell. It works fine without any fuss. I tried to have the commands in a script file and run in the CPO. It still runs for a long time without any output.