Parse Error Creating AWS Event From the CLI - amazon-web-services

I'm trying to create an event using the AWS CLI. When I issue this command:
aws events put-targets --rule Rotate-Old-Access-Keys-Notification-Scheduler --targets "Id"="1","Arn"="arn:aws:lambda:us-east-1:12345678910:function:rotate-old-access-keys-notification-sender" --profile=lab
I get the error:
Error parsing parameter '--targets': Expected: '=', received: 'EOF' for input:
Id
^
How can I fix this command so that it works?

There is an issue while you are trying to parse profile to your command. Below command should work.
aws events put-targets --rule Rotate-Old-Access-Keys-Notification-Scheduler --targets "Id"="1","Arn"="arn:aws:lambda:us-east-1:12345678910:function:rotate-old-access-keys-notification-sender" --profile lab

Related

Not able to Create Contact flow with lex bot

Trying to migrate contact flow from one instance to other able to migrate simple flow but issue is when I tried with lex bot not able to migrate contact flow.
aws connect describe-contact-flow --instance-id <value> --contact-flow-id <value> --region us-east-1
aws connect create-contact-flow --instance-id <value> --name test_flow --type AGENT_TRANSFER --region 'us-east-1' --content "{\"Version\":\"2019-10-30\",\"StartAction\":\"cd60c6aa-6229-4a47-81ae-bef78a528590\",\"Metadata\":{\"entryPointPosition\":{\"x\":15,\"y\":23.99998474121091},\"snapToGrid\":false,\"ActionMetadata\":{\"bbb8a214-1f5c-4534-bfe5-6bf5f0aab9a0\":{\"position\":{\"x\":685,\"y\":132}},\"d76376f8-9b97-42dc-8b96-60167fd5f7a2\":{\"position\":{\"x\":351,\"y\":15}},\"cd60c6aa-6229-4a47-81ae-bef78a528590\":{\"position\":{\"x\":194,\"y\":197.3333282470703},\"useDynamic\":false},\"e36919ca-8fe7-4797-8c7e-6524acd838f8\":{\"position\":{\"x\":446,\"y\":208},\"conditionMetadata\":[],\"useDynamic\":false,\"dynamicMetadata\":{},\"useLexBotDropdown\":true,\"useDynamicLexBotArn\":false,\"lexV2BotName\":\"jenkinsbooktrip\"}}},\"Actions\":[{\"Identifier\":\"bbb8a214-1f5c-4534-bfe5-6bf5f0aab9a0\",\"Type\":\"DisconnectParticipant\",\"Parameters\":{},\"Transitions\":{}},{\"Identifier\":\"d76376f8-9b97-42dc-8b96-60167fd5f7a2\",\"Parameters\":{\"FlowLoggingBehavior\":\"Enabled\"},\"Transitions\":{\"NextAction\":\"bbb8a214-1f5c-4534-bfe5-6bf5f0aab9a0\",\"Errors\":[],\"Conditions\":[]},\"Type\":\"UpdateFlowLoggingBehavior\"},{\"Identifier\":\"cd60c6aa-6229-4a47-81ae-bef78a528590\",\"Parameters\":{\"Text\":\"hi welcome\"},\"Transitions\":{\"NextAction\":\"e36919ca-8fe7-4797-8c7e-6524acd838f8\",\"Errors\":[],\"Conditions\":[]},\"Type\":\"MessageParticipant\"},{\"Identifier\":\"e36919ca-8fe7-4797-8c7e-6524acd838f8\",\"Parameters\":{\"Text\":\"welcome\",\"LexBot\":{\"Name\":\"jenkinsbooktrip\",\"Region\":\"us-east-1\",\"Alias\":\"$LATEST\"}},\"Transitions\":{\"NextAction\":\"bbb8a214-1f5c-4534-bfe5-6bf5f0aab9a0\",\"Errors\":[{\"NextAction\":\"bbb8a214-1f5c-4534-bfe5-6bf5f0aab9a0\",\"ErrorType\":\"NoMatchingError\"},{\"NextAction\":\"d76376f8-9b97-42dc-8b96-60167fd5f7a2\",\"ErrorType\":\"NoMatchingCondition\"}],\"Conditions\":[]},\"Type\":\"ConnectParticipantWithLexBot\"}]}"
An error occurred (InvalidContactFlowException) when calling the CreateContactFlow operation: None,
when trying without lex parameter it working fine able to create but with lex its through an error I am using aws cli command
I have had the same issue generally with connect. When the content is less than ~1500-2000 characters, the Api works perfectly. Once the contact flow content grows beyond that, you start getting those errors.
Yes that's right need to skip $ symbol and it will work fine.

Create AWS Connect Contact flow using CLI

I am trying to create a contact flow in my connect instance and keep getting the following issue when trying to use the AWS CLI.
An error occurred (InvalidRequestException) when calling the CreateContactFlow operation: Invalid request
aws connect create-contact-flow --instance-id b835bc8c-7c26-4f26-a471-16b806ccf1a2 --name jenkinsTest --type CONTACT_FLOW --content "{\"Version\":\"2019-10-30\",\"StartAction\":\"1a34ecf3-77ff-46a7-b210-38a1a980127b\",\"Metadata\":{\"entryPointPosition\":{\"x\":75,\"y\":20},\"snapToGrid\":false,\"ActionMetadata\":{\"1a34ecf3-77ff-46a7-b210-38a1a980127b\":{\"position\":{\"x\":258,\"y\":66},\"audio\":[{\"type\":\"Text\",\"tts\":\"<speak>You are on hold <break time=\\\"10s\\\"/></speak>\",\"$$hashKey\":\"01J\",\"ttsType\":\"ssml\"}],\"timeoutUnit\":{\"display\":\"Minutes\",\"value\":\"min\"}}}},\"Actions\":[{\"Identifier\":\"1a34ecf3-77ff-46a7-b210-38a1a980127b\",\"Parameters\":{\"Messages\":[{\"SSML\":\"<speak>You are on hold <break time=\\\"10s\\\"/></speak>\"}]},\"Transitions\":{\"Errors\":[],\"Conditions\":[]},\"Type\":\"MessageParticipantIteratively\"}]}"
I am using the above CLI command. Can Any one help me to figure out this error?
MigrateContactFlows API reference

Why I get error usage command amazon cli?

¿How are you?
I'm trying to use this command in Amazon CLI:
aws autoscaling describe-launch-configurations \
--query "LaunchConfigurations[?contains(LaunchConfigurationName,'Extra')].LaunchConfigurationName\
| sort_by(LaunchConfigurations, &CreatedTime)[0].[CreatedTime,LaunchConfigurationName]
But I have an error:
In function sort_by(), invalid type for value: None, expected one of: ['array'], received: "null"
In the first part, I get a list of Launch configuration on Amazon EC2. Why in sort_by, I receive a null output?
When I execute the command without sort_by, I don't have any problem....
if your list returned by the query contains no results. the sort command will respond 'null'

AWS - How can I create event source mapping for fifo lambda?

I'm trying to create an event source mapping with the AWS cli, but I keep getting a combination of errors that don't add up. Here's what I've tried:
aws lambda create-event-source-mapping --function-name someFunctionName --batch-size 100 --starting-position LATEST --event-source arn:aws:sqs:eu-central-1:someARN:SomeQueue.fifo
This results in: An error occurred (InvalidParameterValueException) when calling the CreateEventSourceMapping operation: StartingPosition
is not valid for SQS event sources.
Then I try without the starting position: aws lambda create-event-source-mapping --function-name someFunctionName --batch-size 100 --event-source arn:aws:sqs:eu-central-1:someARN:SomeQueue.fifo which results in: error: argument --starting-position is required
Am I missing something? How am I supposed to call this command?
aws -version tells me I'm running aws-cli/1.15.10 Python/2.7.9 Windows/2012Server botocore/1.10.10. Is this just an out of date version?
So, as I'm writing this question I upgrade the cli to 2.0.9 and option 2 works!!!
Upgraded the cli to 2.0.9 and option 2 works!!!

Calling Rekognition using AWS CLI

I have the AWS CLI installed on Windows and am using the Windows command prompt.
I am trying to use Rekognition but I cannot seem to get any commands working. The closest I have gotten is with:
aws rekognition detect-faces --image S3Object=\{Bucket=innovation-bucket,Name=image.jpg,Version=1\} --attributes "ALL" --region us-east-1
This results in:
Error parsing parameter '--image': Expected: ',', received: '}' for input: S3Object={Bucket=innovation-bucket,Name=image.jpg,Version=1}
Why is it expecting a comma?
EDIT:
When I try the format from the documentation I also get errors:
aws rekognition detect-faces --image '{"S3Object":{"Bucket":"innovation-bucket","Name":"image.jpg"}}' --attributes "ALL" --region us-east-1
Error parsing parameter '--image': Expected: '=', received ''' for input: '{"S3Object":{"Bucket":"innovation-bucket","Name":"image.jpg‌​"}}'
1) Your AWS CLI should be something like below, refer this documentation:
aws rekognition search-faces-by-image \
--image '{"S3Object":{"Bucket":"bucket-name","Name":"Example.jpg"}}' \
--collection-id "collection-id" \
--region us-east-1 \
--profile adminuser
2) If your AWS CLI installed on windows box, make sure you change "the single quotes to double quotes and the double quotes to escaped quotes"