{"action":"created","issue":{"url":"https://api.github.com/repos/awslabs/aws-iot-certificate-vending-machine/issues/1","repository_url":"https://api.github.com/repos/awslabs/aws-iot-certificate-vending-machine","labels_url":"https://api.github.com/repos/awslabs/aws-iot-certificate-vending-machine/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/awslabs/aws-iot-certificate-vending-machine/issues/1/comments","events_url":"https://api.github.com/repos/awslabs/aws-iot-certificate-vending-machine/issues/1/events","html_url":"https://github.com/awslabs/aws-iot-certificate-vending-machine/issues/1","id":315438636,"number":1,"title":"CVM create multiple certificates ","user":{"login":"wsilverky","id":20527421,"avatar_url":"https://avatars0.githubusercontent.com/u/20527421?v=4","gravatar_id":"","url":"https://api.github.com/users/wsilverky","html_url":"https://github.com/wsilverky","followers_url":"https://api.github.com/users/wsilverky/followers","following_url":"https://api.github.com/users/wsilverky/following{/other_user}","gists_url":"https://api.github.com/users/wsilverky/gists{/gist_id}","starred_url":"https://api.github.com/users/wsilverky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wsilverky/subscriptions","organizations_url":"https://api.github.com/users/wsilverky/orgs","repos_url":"https://api.github.com/users/wsilverky/repos","events_url":"https://api.github.com/users/wsilverky/events{/privacy}","received_events_url":"https://api.github.com/users/wsilverky/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-18T11:22:32Z","updated_at":"2018-04-22T06:07:02Z","closed_at":null,"author_association":"NONE","body":" I need the template.yaml to creat the CVM, and the accessToken and serialNumber can create multiple certificates ,but just return once. So,need I do extra something to avoid it?\r\n\r\nthe second creatition log is:\r\n2018-04-18T11:13:25.351Z\t81e505c0-42f9-11e8-8dcd-5360239d60ce\t{ certificateArn: 'arn:aws:iot:us-east-1:506128028316:cert/5596bd96e0c1219b61f2a03742add29415513eb6c08d6d4788f69bd85e12809c',\r\ncertificateId: '5596bd96e0c1219b61f2a03742add29415513eb6c08d6d4788f69bd85e12809c',\r\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aOzsggda0KswbD9sR+YEG9a7pcvdDFO8VdC+LCcQ09\\npcBBAoGBAIAK75kv2qOZhTbkk/T4UuohQuwG0iqCPReG2/inH5gsfeRmblSrq50W\\nqC1xhMbQosBR7t9OGkCF1yypW8qW3a8wh2JoOXV1tbjc6lC9DTsuVL/VXi3s1IbG\\nJkWq4RTi9oTCwudLYUZyQuB6+2HCDP7SkWeCdEiH6vnbqEnufCSt\\n-----END RSA PRIVATE KEY-----\\n' } }\r\n2018-04-18T11:13:25.531Z\t81e505c0-42f9-11e8-8dcd-5360239d60ce\t{ ResourceAlreadyExistsException: Policy cannot be created - name already exists (name=value1)\r\nat Object.extractError (/var/runtime/node_modules/aws-sdk/lib/protocol/json.js:48:27)\r\nat Request.extractError (/var/runtime/node_modules/aws-sdk/lib/protocol/rest_json.js:52:8)\r\nat Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:105:20)\r\nat Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:77:10)\r\nat Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:683:14)\r\nat Request.transition (/var/runtime/node_modules/aws-sdk/lib/request.js:22:10)\r\nat AcceptorStateMachine.runTo (/var/runtime/node_modules/aws-sdk/lib/state_machine.js:14:12)\r\nat /var/runtime/node_modules/aws-sdk/lib/state_machine.js:26:10\r\nat Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:38:9)\r\nat Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:685:12)\r\nmessage: 'Policy cannot be created - name already exists (name=value1)',\r\ncode: 'ResourceAlreadyExistsException',\r\ntime: 2018-04-18T11:13:25.528Z,\r\nrequestId: '8370610f-42f9-11e8-a62d-6119292db4d5',\r\nstatusCode: 409,\r\nretryable: false,\r\nretryDelay: 28.728075605593983 } 'ResourceAlreadyExistsException: Policy cannot be created - name already exists (name=value1)\\n at Object.extractError (/var/runtime/node_modules/aws-sdk/lib/protocol/json.js:48:27)\\n at Request.extractError (/var/runtime/node_modules/aws-sdk/lib/protocol/rest_json.js:52:8)\\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:683: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:685:12)'\r\n![image](https://user-images.githubusercontent.com/20527421/38928962-63e4c46a-433d-11e8-9d0e-c232fead75c8.png)\r\n"},"comment":{"url":"https://api.github.com/repos/awslabs/aws-iot-certificate-vending-machine/issues/comments/383358101","html_url":"https://github.com/awslabs/aws-iot-certificate-vending-machine/issues/1#issuecomment-383358101","issue_url":"https://api.github.com/repos/awslabs/aws-iot-certificate-vending-machine/issues/1","id":383358101,"user":{"login":"cncoder","id":11889736,"avatar_url":"https://avatars0.githubusercontent.com/u/11889736?v=4","gravatar_id":"","url":"https://api.github.com/users/cncoder","html_url":"https://github.com/cncoder","followers_url":"https://api.github.com/users/cncoder/followers","following_url":"https://api.github.com/users/cncoder/following{/other_user}","gists_url":"https://api.github.com/users/cncoder/gists{/gist_id}","starred_url":"https://api.github.com/users/cncoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cncoder/subscriptions","organizations_url":"https://api.github.com/users/cncoder/orgs","repos_url":"https://api.github.com/users/cncoder/repos","events_url":"https://api.github.com/users/cncoder/events{/privacy}","received_events_url":"https://api.github.com/users/cncoder/received_events","type":"User","site_admin":false},"created_at":"2018-04-22T06:07:02Z","updated_at":"2018-04-22T06:07:02Z","author_association":"CONTRIBUTOR","body":"It seems that the serial number and token have been reused, resulting in duplicate creation of the same policy name as before.  BTW, although the certificate has been created, it has no effect. \r\n\r\nIn addition, we should determine whether the device can be re-registered based on actual.  If the device does not run duplicate registration, it is recommended to check whether the certinfo field is null when verifying the device.\r\n\r\nThanks for your issue."}}
{"actor":{"display_login":"cncoder"}}