I have tried with the below
Is my Date format correct as per awscli LaunchTime ?
To get the last 5 Days Instance count which was created via LaunchTime with of AWS cli in Powershell:
$getDays = Get-Date
$5Days = $getDays.AddDays(-5).ToString('yyyy-MM-dd')
$instancesCreated = aws ec2 --profile $awsProfile --region $awsRegion describe-instances --query "Reservations[*].Instances[*].[InstanceId,LaunchTime>='$5Days']"
Write-Output (" Total instances count in last 5days : " +$instancesCreated)
But I am not getting the actual count here, getting the Total counts - anything if I am missing here ?