AWS-AMI-Automated-Creation-Deletion
                                
                                 AWS-AMI-Automated-Creation-Deletion copied to clipboard
                                
                                    AWS-AMI-Automated-Creation-Deletion copied to clipboard
                            
                            
                            
                        Malformed AMI name
Currently the AMI name is based on the EC2 instance tag name. But the name of the instance allows more characters than the name of the AMI. For the instance I was trying to back up, the script throws this error:
2017-07-06T03:10:32.880Z	aa144caa-61f8-11e7-b3c3-515643d3a81c	{ [InvalidAMIName.Malformed: AMI names must be between 3 and 128 characters long, and may contain letters, numbers, '(', ')', '.', '-', '/' and '_']
message: 'AMI names must be between 3 and 128 characters long, and may contain letters, numbers, \'(\', \')\', \'.\', \'-\', \'/\' and \'_\'',
code: 'InvalidAMIName.Malformed',
time: Thu Jul 06 2017 03:10:32 GMT+0000 (UTC),
requestId: 'd0dc4e92-fe6c-4d3e-84ea-1e9bda700bc7',
statusCode: 400,
retryable: false,
retryDelay: 99.96723912190646 } 'InvalidAMIName.Malformed: AMI names must be between 3 and 128 characters long, and may contain letters, numbers, \'(\', \')\', \'.\', \'-\', \'/\' and \'_\'\n at Request.extractError (/var/runtime/node_modules/aws-sdk/lib/services/ec2.js:50:35)\n at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:105:20)\n at Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:77:10)\n at Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:678:14)\n at Request.transition (/var/runtime/node_modules/aws-sdk/lib/request.js:22:10)\n at AcceptorStateMachine.runTo (/var/runtime/node_modules/aws-sdk/lib/state_machine.js:14:12)\n at /var/runtime/node_modules/aws-sdk/lib/state_machine.js:26:10\n at Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:38:9)\n at Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:680:12)\n at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:115:18)'
I'll try submit a pull request to fix this in a bit.