aws-samples / aws-iam-access-key-auto-rotation

This set of CloudFormation templates and Python scripts will set up an auto-rotation function that will automatically rotate your AWS IAM User Access Keys every 90 days.
MIT No Attribution
134 stars 128 forks source link

Getting Error in Lambda #5

Closed harshit895 closed 2 years ago

harshit895 commented 2 years ago
{
  "errorMessage": "Parameter validation failed:\nInvalid type for parameter AccessKeyId, value: {'UserName': 'tests3', 'AccessKeyId': 'AAIAIHTLKD3R3I57CPBQ', 'Status': 'Inactive', 'CreateDate': datetime.datetime(2017, 12, 20, 6, 28, 52, tzinfo=tzlocal())}, type: <class 'dict'>, valid types: <class 'str'>",
  "errorType": "ParamValidationError",
  "stackTrace": [
    "  File \"/var/task/lambda_function.py\", line 116, in lambda_handler\n    process_user(user, response, False)\n",
    "  File \"/var/task/lambda_function.py\", line 245, in process_user\n    iam.delete_access_key(UserName=user_name,\n",
    "  File \"/var/runtime/botocore/client.py\", line 386, in _api_call\n    return self._make_api_call(operation_name, kwargs)\n",
    "  File \"/var/runtime/botocore/client.py\", line 677, in _make_api_call\n    request_dict = self._convert_to_request_dict(\n",
    "  File \"/var/runtime/botocore/client.py\", line 725, in _convert_to_request_dict\n    request_dict = self._serializer.serialize_to_request(\n",
    "  File \"/var/runtime/botocore/validate.py\", line 319, in serialize_to_request\n    raise ParamValidationError(report=report.generate_report())\n"
  ]
}
vsagarv commented 2 years ago

@harshit895 I see another issue like this which was closed earlier - https://github.com/aws-samples/aws-iam-access-key-auto-rotation/issues/3 Do you still see this issue?

bumblebee939 commented 2 years ago

Yes I still see the issue, do you know the resolution @vsagarv ?

aws-laura commented 2 years ago

Solution for version 1: In "IAM-Access-Key-Rotation-LambdaFunctionName" key_to_delete should be key_to_delete["AccessKeyId"] on line 243 and 244.

FYI - we have just released a version 2 where this issue has been resolved.

bumblebee939 commented 2 years ago

Solution for version 1: In "IAM-Access-Key-Rotation-LambdaFunctionName" key_to_delete should be key_to_delete["AccessKeyId"] on line 243 and 244.

FYI - we have just released a version 2 where this issue has been resolved.

Thanks Laura