Hi Ahmed, thanks for your reading.
Sure, you could use the DynamoDB database to store the cart items. For authentication you could use the AWS Cognito service.
A nice blog post illustrating this can be found here https://auth0.com/blog/building-serverless-apps-with-aws-lambda/
Feel free to extend the existing github repo with that functionality.