Your problem is likely spaces. That file is a YAML file. If your copy/paste is accurate, it won't be able to parse the file as whitespace is very important in YAML files.
You didn't include which platform you are targeting, although that is likely irrelevant for what you are doing. To test this quickly, I spun up a python 3.8 environment in an AWS region in Elastic Beanstalk. I started with downloading a sample configuration from: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/tutorials.html - I used the python.zip file, but like I mentioned, I didn't actually modify any of the python code.
I first deployed without any changes to make sure it came up. It responded on port 80 in a web browser. I then added my SSH key (under the configuration->security) screen. I was able to successfully SSH into the box and confirm that pdftk was not installed.
I unziped the python.zip file and in the .ebextensions directory added a new configuration file named 01pdftk.config
with the following:
commands:
01_wget_pdftk:
command: "sudo wget https://hone-compiled-packages.s3.eu-central-1.amazonaws.com/pdftk-pdfw-2.02-1.x86_64.rpm"
cwd: "/root"
ignoreErrors: false
02_install_pdftk:
command: "sudo rpm -ivh /root/pdftk-pdfw-2.02-1.x86_64.rpm"
cwd: "/root"
ignoreErrors: false
The spaces ARE important! I then rezipped it up (making sure that when I opened the zip the .ebextensions directory was at the root of the zip) and uploaded to AWS using the upload and deploy button. I uploaded the zip, waiting a little for it to apply and then SSH'd into the box to confirm it was installed.
[ec2-user@ip-XXX-XXX-XXX-XXX ~]$ sudo ls /root
pdftk-pdfw-2.02-1.x86_64.rpm
[ec2-user@ip-XXX-XXX-XXX-XXX ~]$ rpm -qa | grep pdftk
pdftk-pdfw-2.02-1.x86_64
As you can see, pdftk was installed.