With AWS Elastic Beanstalk, you supply the code and configuration settings, while it manages the necessary resources to:
With AWS CloudFormation, you can manage your infrastructure as code.
This service allows you to create an environment by writing code, eliminating the need to provision resources individually through the AWS Management Console.