:doc:`ElasticBeanstalk <../../elasticbeanstalk>` / Client / create_application

******************
create_application
******************



.. py:method:: ElasticBeanstalk.Client.create_application(**kwargs)

  

  Creates an application that has one configuration template named ``default`` and no application versions.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/elasticbeanstalk-2010-12-01/CreateApplication>`_  


  **Request Syntax**
  ::

    response = client.create_application(
        ApplicationName='string',
        Description='string',
        ResourceLifecycleConfig={
            'ServiceRole': 'string',
            'VersionLifecycleConfig': {
                'MaxCountRule': {
                    'Enabled': True|False,
                    'MaxCount': 123,
                    'DeleteSourceFromS3': True|False
                },
                'MaxAgeRule': {
                    'Enabled': True|False,
                    'MaxAgeInDays': 123,
                    'DeleteSourceFromS3': True|False
                }
            }
        },
        Tags=[
            {
                'Key': 'string',
                'Value': 'string'
            },
        ]
    )
    
  :type ApplicationName: string
  :param ApplicationName: **[REQUIRED]** 

    The name of the application. Must be unique within your account.

    

  
  :type Description: string
  :param Description: 

    Your description of the application.

    

  
  :type ResourceLifecycleConfig: dict
  :param ResourceLifecycleConfig: 

    Specifies an application resource lifecycle configuration to prevent your application from accumulating too many versions.

    

  
    - **ServiceRole** *(string) --* 

      The ARN of an IAM service role that Elastic Beanstalk has permission to assume.

       

      The ``ServiceRole`` property is required the first time that you provide a ``VersionLifecycleConfig`` for the application in one of the supporting calls ( ``CreateApplication`` or ``UpdateApplicationResourceLifecycle``). After you provide it once, in either one of the calls, Elastic Beanstalk persists the Service Role with the application, and you don't need to specify it again in subsequent ``UpdateApplicationResourceLifecycle`` calls. You can, however, specify it in subsequent calls to change the Service Role to another value.

      

    
    - **VersionLifecycleConfig** *(dict) --* 

      Defines lifecycle settings for application versions.

      

    
      - **MaxCountRule** *(dict) --* 

        Specify a max count rule to restrict the number of application versions that are retained for an application.

        

      
        - **Enabled** *(boolean) --* **[REQUIRED]** 

          Specify ``true`` to apply the rule, or ``false`` to disable it.

          

        
        - **MaxCount** *(integer) --* 

          Specify the maximum number of application versions to retain.

          

        
        - **DeleteSourceFromS3** *(boolean) --* 

          Set to ``true`` to delete a version's source bundle from Amazon S3 when Elastic Beanstalk deletes the application version.

          

        
      
      - **MaxAgeRule** *(dict) --* 

        Specify a max age rule to restrict the length of time that application versions are retained for an application.

        

      
        - **Enabled** *(boolean) --* **[REQUIRED]** 

          Specify ``true`` to apply the rule, or ``false`` to disable it.

          

        
        - **MaxAgeInDays** *(integer) --* 

          Specify the number of days to retain an application versions.

          

        
        - **DeleteSourceFromS3** *(boolean) --* 

          Set to ``true`` to delete a version's source bundle from Amazon S3 when Elastic Beanstalk deletes the application version.

          

        
      
    
  
  :type Tags: list
  :param Tags: 

    Specifies the tags applied to the application.

     

    Elastic Beanstalk applies these tags only to the application. Environments that you create in the application don't inherit the tags.

    

  
    - *(dict) --* 

      Describes a tag applied to a resource in an environment.

      

    
      - **Key** *(string) --* 

        The key of the tag.

        

      
      - **Value** *(string) --* 

        The value of the tag.

        

      
    

  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'Application': {
              'ApplicationArn': 'string',
              'ApplicationName': 'string',
              'Description': 'string',
              'DateCreated': datetime(2015, 1, 1),
              'DateUpdated': datetime(2015, 1, 1),
              'Versions': [
                  'string',
              ],
              'ConfigurationTemplates': [
                  'string',
              ],
              'ResourceLifecycleConfig': {
                  'ServiceRole': 'string',
                  'VersionLifecycleConfig': {
                      'MaxCountRule': {
                          'Enabled': True|False,
                          'MaxCount': 123,
                          'DeleteSourceFromS3': True|False
                      },
                      'MaxAgeRule': {
                          'Enabled': True|False,
                          'MaxAgeInDays': 123,
                          'DeleteSourceFromS3': True|False
                      }
                  }
              }
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 

      Result message containing a single description of an application.

      
      

      - **Application** *(dict) --* 

        The  ApplicationDescription of the application.

        
        

        - **ApplicationArn** *(string) --* 

          The Amazon Resource Name (ARN) of the application.

          
        

        - **ApplicationName** *(string) --* 

          The name of the application.

          
        

        - **Description** *(string) --* 

          User-defined description of the application.

          
        

        - **DateCreated** *(datetime) --* 

          The date when the application was created.

          
        

        - **DateUpdated** *(datetime) --* 

          The date when the application was last modified.

          
        

        - **Versions** *(list) --* 

          The names of the versions for this application.

          
          

          - *(string) --* 
      
        

        - **ConfigurationTemplates** *(list) --* 

          The names of the configuration templates associated with this application.

          
          

          - *(string) --* 
      
        

        - **ResourceLifecycleConfig** *(dict) --* 

          The lifecycle settings for the application.

          
          

          - **ServiceRole** *(string) --* 

            The ARN of an IAM service role that Elastic Beanstalk has permission to assume.

             

            The ``ServiceRole`` property is required the first time that you provide a ``VersionLifecycleConfig`` for the application in one of the supporting calls ( ``CreateApplication`` or ``UpdateApplicationResourceLifecycle``). After you provide it once, in either one of the calls, Elastic Beanstalk persists the Service Role with the application, and you don't need to specify it again in subsequent ``UpdateApplicationResourceLifecycle`` calls. You can, however, specify it in subsequent calls to change the Service Role to another value.

            
          

          - **VersionLifecycleConfig** *(dict) --* 

            Defines lifecycle settings for application versions.

            
            

            - **MaxCountRule** *(dict) --* 

              Specify a max count rule to restrict the number of application versions that are retained for an application.

              
              

              - **Enabled** *(boolean) --* 

                Specify ``true`` to apply the rule, or ``false`` to disable it.

                
              

              - **MaxCount** *(integer) --* 

                Specify the maximum number of application versions to retain.

                
              

              - **DeleteSourceFromS3** *(boolean) --* 

                Set to ``true`` to delete a version's source bundle from Amazon S3 when Elastic Beanstalk deletes the application version.

                
          
            

            - **MaxAgeRule** *(dict) --* 

              Specify a max age rule to restrict the length of time that application versions are retained for an application.

              
              

              - **Enabled** *(boolean) --* 

                Specify ``true`` to apply the rule, or ``false`` to disable it.

                
              

              - **MaxAgeInDays** *(integer) --* 

                Specify the number of days to retain an application versions.

                
              

              - **DeleteSourceFromS3** *(boolean) --* 

                Set to ``true`` to delete a version's source bundle from Amazon S3 when Elastic Beanstalk deletes the application version.

                
          
        
      
    
  
  **Exceptions**
  
  *   :py:class:`ElasticBeanstalk.Client.exceptions.TooManyApplicationsException`

  

  **Examples**

  The following operation creates a new application named my-app:
  ::

    response = client.create_application(
        ApplicationName='my-app',
        Description='my application',
    )
    
    print(response)

  
  Expected Output:
  ::

    {
        'Application': {
            'ApplicationName': 'my-app',
            'ConfigurationTemplates': [
            ],
            'DateCreated': datetime(2015, 2, 12, 18, 32, 21, 3, 43, 0),
            'DateUpdated': datetime(2015, 2, 12, 18, 32, 21, 3, 43, 0),
            'Description': 'my application',
        },
        'ResponseMetadata': {
            '...': '...',
        },
    }

  