description: | This action will run the CEDR to DRS start-upgrade action. This is meant to run on all nodes that will be upgraded to DRS. schemaVersion: '2.2' parameters: awsAccessKeySecret: type: String description: (Required) AWS access key from target DRS account IAM user. allowedPattern: "[A-Za-z0-9]{20}" CloudEndureSecrets: type: String description: (Required) AWS secret access key from target DRS account IAM user. allowedPattern: "[A-Za-z0-9]{31}/[A-Za-z0-9]+$" mainSteps: - action: aws:runShellScript name: installJQ precondition: StringEquals: - platformType - Linux inputs: timeoutSeconds: '300' runCommand: - | if command -v apt-get >/dev/null; then sudo apt-get install -y jq elif command -v yum >/dev/null; then sudo yum install -y jq else echo "Package Manager unknown, please install jq manually" fi - action: aws:downloadContent name: downloadUpgradeLinux precondition: StringEquals: - platformType - Linux inputs: sourceType: "S3" sourceInfo: '{"path": "https://cloudendure-assets.s3.us-east-1.amazonaws.com/latest/cloudendure_to_drs_upgrade_tool.py"}' - action: aws:runShellScript name: RunStartUpgradeToolLinux precondition: StringEquals: - platformType - Linux inputs: timeoutSeconds: '3600' runCommand: - | awsAccessKey=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id {{awsAccessKeySecret}} --query "SecretString" --output text | jq -r '.awsAccessKey') awsSecretAccessKey=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id {{awsAccessKeySecret}} --query "SecretString" --output text | jq -r '.awsSecretAccessKey') apiToken=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id {{CloudEndureSecrets}} --query "SecretString" --output text | jq -r '.apiToken') projectId=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id {{CloudEndureSecrets}} --query "SecretString" --output text | jq -r '.projectId') python3 cloudendure_to_drs_upgrade_tool.py start-upgrade --no-prompt --ignore-validation-warnings --import-replication-configuration --api-token $apiToken --project-id $projectId --aws-access-key-id $awsAccessKey --aws-secret-access-key $awsSecretAccessKey --import-test-snapshot --import-blueprint - action: aws:downloadContent name: downloadUpgradeWindows precondition: StringEquals: - platformType - Windows inputs: sourceType: "S3" sourceInfo: '{"path": "https://cloudendure-assets.s3.us-east-1.amazonaws.com/latest/cloudendure_to_drs_upgrade_tool.exe"}' destinationPath: "C:\\temp\\" - action: aws:runPowerShellScript name: RunStartUpgradeToolWindows precondition: StringEquals: - platformType - Windows inputs: timeoutSeconds: '3600' runCommand: - | $AccessKeys = Get-SECSecretValue -SecretId {{awsAccessKeySecret}} -ErrorAction Stop | Select-Object -ExpandProperty 'SecretString' | ConvertFrom-Json -ErrorAction Stop $KeyId = $AccessKeys.awsAccessKey $SecretKey = $AccessKeys.awsSecretAccessKey $CEDRSecrets = Get-SECSecretValue -SecretId {{CloudEndureSecrets}} -ErrorAction Stop | Select-Object -ExpandProperty 'SecretString' | ConvertFrom-Json -ErrorAction Stop $Apitoken = $CEDRSecrets.apiToken $ProjectId = $CEDRSecrets.projectId $Install = Start-Process -NoNewWindow -PassThru -Wait -FilePath "C:\temp\cloudendure_to_drs_upgrade_tool.exe" -ArgumentList "start-upgrade --no-prompt --ignore-validation-warnings --import-replication-configuration --api-token $Apitoken --project-id $ProjectId --aws-access-key-id $KeyId --aws-secret-access-key $SecretKey --import-test-snapshot --import-blueprint" If ($Install.ExitCode -ne 0) { Write-Output "Error Upgrading to DRS exit code $($Process.ExitCode)" Exit 1 }