aws-samples / aws-serverless-connect-wallboard

Sample code for building a serverless wallboard for Amazon Connect.
MIT No Attribution
28 stars 18 forks source link

Importing definition file using wallboard import utility #1

Closed babunirwan closed 2 years ago

babunirwan commented 3 years ago

Hi,

Can you please specify the details steps needed to run that wallboard import utility. Currently don't have much idea from where and how to run that command to import wallboard definition into dynamo db table.

Brettles commented 3 years ago

Hello! Are you looking for instructions on how to create the definition file? Or just how to run the utility?

If the second, you will need to have Python and the boto3 library installed. Then, you can run ./wallboard-import.py definitionfile.yaml and you're good to go (if on Linux). On Windows it will be wallboard-import.py definitionfile.yaml - if that doesn't help please reply back and I'll provide more information.

If you're seeing an error message please also provide that.

babunirwan commented 3 years ago

Hello! Are you looking for instructions on how to create the definition file? Or just how to run the utility?

If the second, you will need to have Python and the boto3 library installed. Then, you can run ./wallboard-import.py definitionfile.yaml and you're good to go (if on Linux). On Windows it will be wallboard-import.py definitionfile.yaml - if that doesn't help please reply back and I'll provide more information.

If you're seeing an error message please also provide that.

Only how to run the utility. I am on windows. So I need to install python and boto3 library and then run the command. Is there not any other way to do this step from AWS directly so that local installation is not required of python and boto3. If yes please suggest the code changes or steps required.

Brettles commented 3 years ago

In theory, you could create the DynamoDB records required directly - that's what the utility does; it reads the definition file and creates the records that are required. However, the reason the utility exists is to create those records from an easily-read template file rather than having to do it manually (which is quite difficult). I'd recommend using the utility - even if you have to spin up a small instance in AWS (perhaps temporarily) to do it.

babunirwan commented 3 years ago

In theory, you could create the DynamoDB records required directly - that's what the utility does; it reads the definition file and creates the records that are required. However, the reason the utility exists is to create those records from an easily-read template file rather than having to do it manually (which is quite difficult). I'd recommend using the utility - even if you have to spin up a small instance in AWS (perhaps temporarily) to do it.

I did the installation and run the command. It did not give any result or error. How can I verify if the command executed successfully? And where is the link to the AWS that it has to do the changes in dynamo db ? On running sample example page it says - Wallboard agents not found which means command does not run successfully. How can I verify or can be the error in this case.

Definition file - WallboardTemplateFormatVersion: 1 Description: Agent Wallboard Identifier: agents

Defaults: TextColor: black BackgroundColor: white TextSize: 15

AgentStates:

Rows:

Brettles commented 3 years ago

If the import utility is silent then it's all good - it will only report errors in the definition file when it finds them. The error you're seeing means that the Lambda function that is rendering the wallboard cannot find the definition for "agents" - which is odd because that's the name given in the sample above.

You can check the DynamoDB table in the console and you should see records that look like this:

image

Note the identifier in the first column which is "agents".

babunirwan commented 3 years ago

No tables are created as you mentioned. :( Thing still unclear is I have done local installation. How it is getting linked to AWS without any authentication. There must be something missing. Tried - python wallboard-import.py wallboard-dfn.yaml and now it gives no module found yaml.

Brettles commented 3 years ago

You will definitely need to have some local AWS credentials on the machine - that's what gives you access to DynamoDB to write data to the table. There are many ways to set up your credentials. Normally you would run "aws configure" as part of the CLI setup: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-windows.html - but if you don't need the CLI all you actually need is to create the credentials file with the secret key and access key in it.

babunirwan commented 3 years ago

You will definitely need to have some local AWS credentials on the machine - that's what gives you access to DynamoDB to write data to the table. There are many ways to set up your credentials. Normally you would run "aws configure" as part of the CLI setup: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-windows.html - but if you don't need the CLI all you actually need is to create the credentials file with the secret key and access key in it.

Just checked that credentials file. It is there in the user .aws folder. So I think that is fine. But still dynamo db stuff is not working. Looks like script is not running as per expectations.

Brettles commented 3 years ago

If you do have the AWS CLI installed, you can try doing something like aws dynamodb describe-table --table-name ConnectWallboard - if that works then there's something else going on. If it doesn't work, check to see if there is a file called config in the same places as the credentials folder. It should have a section that looks like:

[default]
region = <your region name here>

If it doesn't, definitely add that and put the region name in - otherwise the code (boto3 and the CLI) don't know where to direct API calls.

bnirwan commented 2 years ago

It was python install error. Its worked later. We can close this one

DominoUB commented 2 years ago

I am having the same issue here. Getting no error but the script is not uploading the table to DynamoDB. I am using VSCode on Windows. I have AWS linked. This wallboard-import.py definitionfile.yaml errors with "The term 'wallboard-import.py' is not recognized as the name of a cmdlet" .\wallboard-import.py definitionfile.yaml gives no errors. aws dynamodb describe-table --table-name ConnectWallboard shows the table exists, And I can see some data in DynamoDB but the data I am getting is the status of agents,

babunirwan commented 2 years ago

Check that python is installed properly. until python installation is proper u will get that issue. Once cmd says python is installed properly then it will start working.

DominoUB commented 2 years ago

Thank you for your response. Yeah it is installed, I have re-installed it to be sure. I think I found the issue stepping through the script Line 239 Exception has occurred: SystemExit 1 File "D:\location\wallboard-import.py", line 239, in sys.exit(1) It might just be VSCode weirdness. Not sure how to work around it though.

DominoUB commented 2 years ago

Hey I found the issue, it was me being stupid. I was executing the script from terminal with powershell, included python -m and now it runs.

Brettles commented 2 years ago

Not being stupid - just learning. And it helps other people to know how to fix the issue...