Use DescribeApplications with an AWS SDK or CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use DescribeApplications with an AWS SDK or CLI

The following code examples show how to use DescribeApplications.

CLI
AWS CLI

To view a list of applications

The following command retrieves information about applications in the current region:

aws elasticbeanstalk describe-applications

Output:

{ "Applications": [ { "ApplicationName": "ruby", "ConfigurationTemplates": [], "DateUpdated": "2015-08-13T21:05:44.376Z", "Versions": [ "Sample Application" ], "DateCreated": "2015-08-13T21:05:44.376Z" }, { "ApplicationName": "pythonsample", "Description": "Application created from the EB CLI using \"eb init\"", "Versions": [ "Sample Application" ], "DateCreated": "2015-08-13T19:05:43.637Z", "ConfigurationTemplates": [], "DateUpdated": "2015-08-13T19:05:43.637Z" }, { "ApplicationName": "nodejs-example", "ConfigurationTemplates": [], "DateUpdated": "2015-08-06T17:50:02.486Z", "Versions": [ "add elasticache", "First Release" ], "DateCreated": "2015-08-06T17:50:02.486Z" } ] }
Ruby
SDK for Ruby
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

# Class to manage Elastic Beanstalk applications class ElasticBeanstalkManager def initialize(eb_client, logger: Logger.new($stdout)) @eb_client = eb_client @logger = logger end # Lists applications and their environments def list_applications @eb_client.describe_applications.applications.each do |application| log_application_details(application) list_environments(application.application_name) end rescue Aws::ElasticBeanstalk::Errors::ServiceError => e @logger.error("Elastic Beanstalk Service Error: #{e.message}") end private # Logs application details def log_application_details(application) @logger.info("Name: #{application.application_name}") @logger.info("Description: #{application.description}") end # Lists and logs details of environments for a given application def list_environments(application_name) @eb_client.describe_environments(application_name: application_name).environments.each do |env| @logger.info(" Environment: #{env.environment_name}") @logger.info(" URL: #{env.cname}") @logger.info(" Health: #{env.health}") end rescue Aws::ElasticBeanstalk::Errors::ServiceError => e @logger.error("Error listing environments for application #{application_name}: #{e.message}") end end