Filtering JSON using jq with a condition

I have the following JSON: { "LaunchTemplates": [ { "LaunchTemplateName": "bla-99", "CreateTime": "2022-12-13T13:40:33+00:00" }, { "LaunchTemplateName": "abcabc", "CreateTime": "2022-12-13T09:58:14+00:00" }, { "LaunchTemplateName": "bla-34", "CreateTime": "2022-12-13T13:58:56+00:00" }, { "LaunchTemplateName": "bla-222", "CreateTime": "2022-12-11T13:58:56+00:00" }, { "LaunchTemplateName": "bla-233", "CreateTime": "2022-12-10T13:58:56+00:00" } ] } I want to filter the JSON and print the oldest templates after filtering. I have… Read More Filtering JSON using jq with a condition

How do i pass a string as payload to aws lambda function using aws cli?

I am trying to use the below aws cli command to invoke the lambda function. aws lambda invoke –invocation-type RequestResponse –function-name HelloWorldJava –payload \"world\" outputfile.txt But Iam getting below error. Invalid base64: ""world"" The book I am referring to is using the same method. >Solution : Your payload has to be JSON according to the… Read More How do i pass a string as payload to aws lambda function using aws cli?

How can I add an IP address in a AWS CLI with out exporting

I am running below command to ingress in was-cli, it is working fine if I provide IP address, but I want it to know IP and pass it. I was trying something like below but it is not helping aws ec2 authorize-security-group-ingress –group-id sg-123456778 –protocol tcp –port 22 –cidr echo "$(curl https://checkip.amazonaws.com)/32" –profile xyzzy If… Read More How can I add an IP address in a AWS CLI with out exporting

AWS CLI | esc return text

How do I escape the AWS CLI return text? i.e. go back to ~$: For example: ~$: aws s3api list-buckets BUCKETS 2021-01-21T10:19:17+00:00 mybucket BUCKETS 2021-05-18T11:37:38+00:00 foobarmadness OWNER itsbritneybitch (END) >Solution : Just press q to exit back to your shell. The q keypress serves as a quit signal for whatever the pager the aws cli… Read More AWS CLI | esc return text

AWS CLI dollar sign '$' escaping when invoking lambda function

there! I got little problem invoking aws lambda function from cli on Windows, my invocation code looks like this aws lambda invoke –function-name blah-blah-event-generator –cli-binary-format raw-in-base64-out –payload ‘{\"UserName\": \"blah-blah\", \"Pwd\": \"blah$$blah\", \"Operation\": \"blah\"}’ response.json And this error occurs An error occurred (InvalidRequestContentException) when calling the Invoke operation: Could not parse request body into json: Could… Read More AWS CLI dollar sign '$' escaping when invoking lambda function

AWS CLI EC2 describe-instances command; how does the `ip-address` filter work?

I am learning how to use the CLI tool for AWS and I come across this command: aws ec2 describe-instances –filters "Name=ip-address,Values=my.test.ip.address" The command works fine and I can see the EC2 instance details in the command output, however, it does not have any field with the name ip-address. Instead, it has PublicIp and PublicIpAddress… Read More AWS CLI EC2 describe-instances command; how does the `ip-address` filter work?