(event)
| 33 | } |
| 34 | |
| 35 | def on_delete(event): |
| 36 | try: |
| 37 | secrets_manager.delete_secret( |
| 38 | SecretId=SECRET_NAME, |
| 39 | ForceDeleteWithoutRecovery=True |
| 40 | ) |
| 41 | except ClientError: |
| 42 | pass |
| 43 | |
| 44 | certificate_id = event['PhysicalResourceId'] |
| 45 | |
| 46 | iot.update_certificate( |
| 47 | certificateId=certificate_id, |
| 48 | newStatus='INACTIVE' |
| 49 | ) |
| 50 | |
| 51 | time.sleep(2) |
| 52 | |
| 53 | iot.delete_certificate( |
| 54 | certificateId=certificate_id |
| 55 | ) |
| 56 | |
| 57 | def lambda_handler(event, context): |
| 58 | print('Received event:', event) |