title: How to Increase Java Heap Size in AWS ECS?
body: <p>I have REST API developed in Java SpringBoot. I have deployed this API as a docker container in AWS ECS. I have allocated 2048 MB as hard memory and 1024 as soft memory in the AWS Task. After ECS launches the docker container, I access the docker container and executed the following command</p>
  <blockquote>
  <p>java -XX:+PrintFlagsFinal -version | grep HeapSize</p>
  </blockquote>
  <p>I get the following result</p>
  <pre><code> uintx ErgoHeapSizeLimit                         = 0                   {product}
      uintx HeapSizePerGCThread                       = 87241520                            {product}
      uintx InitialHeapSize                          := 33554432                            {product}
      uintx LargePageHeapSizeThreshold                = 134217728                           {product}
      **uintx MaxHeapSize                              := 536870912**                           {product}
  </code></pre>
  <p>The MaxHeapSize shown in the result is 536870912 which is approx 536 MB (around half of the soft memory)</p>
  <p>I would like to know how can I increase this heap size to at least 800 MB in the AWS ECS environment.</p>
  <p>I know how to set the heap size using the command java -Xmx800m, but I do not know where to execute this command in the AWS ECS enviornment.</p>