Search code examples
pythonamazon-web-servicesboto3aws-cliaws-iot-greengrass

Cannot deploy AWS Greengrass v2 components with boto3


I developed a greengrass component that is basically a jar, with no configuration, as example to getting started with AWS Greengrass v2. I created a S3 bucket containing the jar and created a Greengrass component to use in my test deployment.

Now that my component was ready I also prepared an EC2 instance following the AWS documentation and I properly configured all the stuff, installing greengrass and so on.

So, last step of my simple test, I had to create the deployment. In order to not do the most trivial things and start thinking to a possible future automation of the process, I decided to create a simple python script using boto3, in order to create the proper API and be able to deploy by modifying the API call.

But, here we are to the problem, I'm having problems with boto3, while with the almost same payload I'm able to deploy from aws cli.

Here you can find the working aws cli I used, and below the related JSON

aws greengrassv2 create-deployment --cli-input-json file://createDeployment.json

enter image description here

Here, instead, you can find the not working python script

enter image description here

Below, you can find the errors I'm getting using the python script, that I'm not facing with the aws cli

enter image description here

Looking at the AWS boto3 documentation for that API call, I didn't found any help, moreover it seems to me that I didn't forget any mandatory parameter, while the error message is stating the opposite.

Do anyone have experience with boto3 and can help me understanding what is missing between the working aws cli command and the not working python command with boto3?

Thanks in advance to everyone


Solution

  • You're using the greengrass V1 client. Your script is for the V2 client, so you need to instantiate your client as:

    client = boto3.client('greengrassv2')