Not able to Create Contact flow with lex bot - amazon-web-services

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.

Related

AWS CLI doesn't show output

I'm running into a weird situation where the aws cli doesn't show output at all. I tried running bad commands and it would show the expected error message but when I run a valid command such as: aws s3api list-buckets --profile prod it doesn't show anything, it just starts new line.

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

EC2 Instance Status using cygwin terminal

I'm trying to get into the reporting of AWS instances within my environments, and I am trying to create a script using AWS cli to generate a report of the status of EC2 instances. I'm still a beginner, so I'm learning how all this works. I was wondering if it was possible to do with a line similar to this:
AWS EC2 describe-instances --region $REGION --query 'Reservations[].Instances[?LaunchTime>=`2015-03-01`][].{id: InstanceId, type: InstanceType, launched: LaunchTime}'
I am using the Cygwin Terminal to perform this query, and any with this would be awesome thanks!
If it's possible I am also trying to see if I could get the CPU usage at that time of the report. I am still trying to understand how all this works since I am new to the AWS API.
Firstly, you will need to install the aws-sdk. Checkout the following answer for doing this in cygwin.
Then you can configure your account using aws configure and following the prompts.
After that you should be able to run aws ec2 describe-instances.
Thanks for everyone's input! I was able to figure it out here. I'm starting to understand how the population output all comes together, but right now I'm trying to put this information into at TSV file. To get the status and launch time of the instances I used the following:
aws ec2 describe-instances --region $REGION --query "Reservations[].Instances[].[InstanceId, LaunchTime, State.Name] --output text >> Instances_In_AWS.tsv
Thank you guys for your help!

aws ec2 describe-instances command not working

I am executing the following command
aws ec2 describe-instances
The error that i am getting is:
Could not connect to the endpoint URL: "https://ec2.us-west-2.amazonaws.com/"
I tried this link in my browser and it was working fine. Actually i am completely new to AWS cli and i am trying to stop, start my instances using AWS cli.
I have used the command aws configure and then provided my access key and secret key. In the region i have entered us-west-2 and output as json.

aws ec2 get-console-output prints nothing to the screen

I am creating an aws ec2 instance using this tutorial, and I can't find any information on troubleshooting my issue, or any evidence that anyone else has even experienced this!
I used an IAM user with admin permissions to set up an ec2 instance, and when I run
$> aws ec2 get-console-output --instance-id <my-ec2-id>
a blank line is output, followed by
'Output'
and nothing else!
According to the tutorial, this command would enable me to see the remote RSA fingerprint to verify I'm making the right connection.
I can log into my ec2 instance just fine (though I suppose without the previous step there's no way to be absolutely sure).
Additionally, the IAM user I'm working with is not my CLI's default user, and I set up a profile to handle it. But if I try
$> aws ec2 get-console-output --profile <user-profile> --instance-id <my-ec2-id>
I still get the same results as before. The maddening thing is that I have solved this problem before, but I can't remember how.
Certain AWS CLI operations may not explicitly state if the credentials are invalid or if users are lacking the roles/permissions to access the resources defined. In this case, it is likely due to the Access Credentials being invalid - and you can verify this with a describe-instances or similar command.
In older versions of the CLI (~1.7), in order to easier debug this, you can use the --debug argument, such as:
> aws ec2 get-console-output --instance-id i-<id> --debug
<Errors><Error><Code>InvalidInstanceID.NotFound</Code><Message>The instance ID 'i-e7bffa43' does not exist</Message></Error></Errors>
In newer versions of the CLI (1.9) this particular argument gives a bit more detail in its error:
> aws ec2 get-console-output --instance-id i-<id>
A client error (InvalidInstanceID.NotFound) occurred when calling the GetConsoleOutput operation: The instance ID 'i-<id>' does not exist