Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    pradeepkusingh
    @pradeepkusingh
    hi
    Matt Benson
    @mbenson
    @aemruli considering the existence of @ConditionalOnAwsCloudEnvironment it would seem that it is intended that one be able to run outside AWS even with the artifacts built into the app. However the condition is only actually used on a couple of the autoconfiguration classes supplied by the -autoconfigure artifact, such that I get startup errors. WDYT about a PR to add the condition in all of these places?
    Niklas Herder
    @herder
    +1 to that. It shouldn't try to use the aws features outside of aws. Would be great if this could be fixed! :)
    Matt Benson
    @mbenson
    I do note that the unit tests will need a good deal of accompanying love, but the foundation is there in the ContextInstanceDataAutoConfigurationTest
    Alain Sahli
    @alainsahli
    Hi @mbenson thanks for reporting it. We’ll look into that the next days
    Matt Benson
    @mbenson
    @alainsahli I went ahead and cooked up a PR.
    spring-cloud/spring-cloud-aws#163
    Matt Benson
    @mbenson
    is anyone interested in discussing this? :)
    Agim Emruli
    @aemruli
    @mbenson yeah we can have a discussion on your PR
    Matt Benson
    @mbenson
    hi!
    Agim Emruli
    @aemruli
    we have tried to make all services usable outside AWS except for 1-2 which are not working outside (namely instance data and caching)
    what is the purpose for filtering out the other ones ?
    Matt Benson
    @mbenson
    I have an application that I'd like to build once and run either in an EC2 instance or locally, same artifact
    Agim Emruli
    @aemruli
    okay, and which services are you using ?
    Matt Benson
    @mbenson
    when I try to start it locally, with spring-cloud-aws-autoconfigure included in the libs, at least two of the autoconfiguration classes are causing it to fail.
    Agim Emruli
    @aemruli
    what is the exception ?
    Matt Benson
    @mbenson
    the exception flows up from EC2MetadataUtils.getInstanceInfo()
    sorry; it's actually caused by that
    but it's the assertion in Ec2MetadataRegionProvider#getRegion()
    Agim Emruli
    @aemruli
    that is strange, we have an @ConditionalOnAwsCloudEnvironment on the respective auto configuration
    Matt Benson
    @mbenson
    but the condition is only applied in one or two places
    Agim Emruli
    @aemruli
    yeah, we do this only for services which really need to run on the AWS EC2 instance (instance data and caching)
    Matt Benson
    @mbenson
    I'm finding that the ContextResourceLoaderAutoConfiguration and ContextRegionProviderAutoConfiguration both seem to be triggering AmazonWebserviceClientFactoryBean#createInstance() which in turn calls #getRegion() from the available RegionProvider.
    If that RegionProvider is Ec2MetadataRegionProvider, boom
    Agim Emruli
    @aemruli
    okay I see
    we have to re-think if it is a good idea to have the EC2 region provider as a default
    I think in your case you have to configure the region if you run locally
    and let that auto-detect in case of an EC2 deployment
    org.springframework.cloud.aws.autoconfigure.context.ContextRegionProviderAutoConfiguration.Registrar#registerBeanDefinitions have to be re-visisted
    cloud.aws.region.static
    Matt Benson
    @mbenson
    I was hoping to avoid, but I agree that from what I have learned so far that should work for now.
    I do think it is nice to use the EC2 region provider when running on AWS
    Agim Emruli
    @aemruli
    I think we can replace this.environment.getProperty("cloud.aws.region.auto", Boolean.class, true) with this.environment.getProperty("cloud.aws.region.auto", Boolean.class, AwsCloudEnvironmentCheckUtils.isRunningOnCloudEnvironment())
    I think that is the only point which needs adjustment
    Matt Benson
    @mbenson
    that's pretty surgical, but it looks like that will result in an exception requiring the statically configured region outside AWS.
    Does a region even make sense outside AWS/EC2?
    Agim Emruli
    @aemruli
    yeah you will need a static region outside aws
    we can not guess it, and we don't rely on the default region
    but I think you can have a separate application.properties or any other way to pass the region only on your local deployment
    Matt Benson
    @mbenson
    but how is the region used outside AWS? Please forgive my newness to the platform.