title: Is it possible to run a Spring Cloud AWS application on Elastic Beanstalk?
body: <p>I'm trying to run a web application of "hello world" complexity on Elastic Beanstalk.  I have no problem doing this with Spring Boot on Elastic Beanstalk.</p>
  
  <p>But when I try to use Spring Cloud AWS, I encounter a myriad of problems.  The reference guide never mentions that running on Beanstalk is possible, so perhaps I am barking up the wrong tree?</p>
  
  <p>The root problem I seem to encounter is the stackResourceRegistryFactoryBean blowing up when trying to identify the "stack" being used - i.e. the CloudFormation stack.  But I'm using Elastic Beanstalk, not CloudFormation.  The root exception is:</p>
  
  <pre><code>Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.aws.core.env.stack.config.StackResourceRegistryFactoryBean]: Factory method 'stackResourceRegistryFactoryBean' threw exception; nested exception is java.lang.IllegalAccessError: tried to access class org.springframework.cloud.aws.core.env.stack.config.AutoDetectingStackNameProvider from class org.springframework.cloud.aws.autoconfigure.context.ContextStackAutoConfiguration$StackAutoDetectConfiguration
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
      at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
      ... 89 more
  Caused by: java.lang.IllegalAccessError: tried to access class org.springframework.cloud.aws.core.env.stack.config.AutoDetectingStackNameProvider from class org.springframework.cloud.aws.autoconfigure.context.ContextStackAutoConfiguration$StackAutoDetectConfiguration
      at org.springframework.cloud.aws.autoconfigure.context.ContextStackAutoConfiguration$StackAutoDetectConfiguration.stackResourceRegistryFactoryBean(ContextStackAutoConfiguration.java:71)
      at org.springframework.cloud.aws.autoconfigure.context.ContextStackAutoConfiguration$StackAutoDetectConfiguration$$EnhancerBySpringCGLIB$$432c7658.CGLIB$stackResourceRegistryFactoryBean$0(&lt;generated&gt;)
      at org.springframework.cloud.aws.autoconfigure.context.ContextStackAutoConfiguration$StackAutoDetectConfiguration$$EnhancerBySpringCGLIB$$432c7658$$FastClassBySpringCGLIB$$47c6e7d2.invoke(&lt;generated&gt;)
      at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
      ...
  </code></pre>
  
  <p>There are tags present on the generated EC2 instance for "aws:cloudformation:stack-id" and "aws:cloudformation:stack-name" if it is relevant, and my understanding is that Beanstalk uses CloudFormation stacks behind the scenes.  I've tried manually specifying the name of the stack via @EnableStackConfiguration, but since the name is generated I'd rather not do this, even if it did work.</p>
  
  <p>So my questions are:
  1) Is it possible to run a Spring Cloud AWS-based application on Elastic Beanstalk?
  2) If so, are there any special steps required?  For example, I already discovered the one about CloudFormation read access being required on the role.
  3) Is there a way to disable the part of Spring Cloud AWS that attempts to obtain resource names from the stack?  At this point my app doesn't need this.</p>
  
  <p>thanks in advance,
  k</p>