spring-attic / spring-cloud-aws

All development has moved to https://github.com/awspring/spring-cloud-aws Integration for Amazon Web Services APIs with Spring
https://awspring.io/
Apache License 2.0
591 stars 373 forks source link

Issues/Questions related to spring-cloud-starter-aws-parameter-store-config #399

Closed venkatduddu closed 5 years ago

venkatduddu commented 5 years ago

Question

  1. What's the reason to have profile used as only suffix to the context i.e current framework only supports (without any prefix) /{appName}/{profileSuffix} for ex: /my-app/test. Any specific reason not to have profile as suffix or provide some configuration to decide profileShould be suffix or prefix.
  2. It seems AWS SDK not allowing querying the contexts that doesn't start with "/". While debugging the code I changed the context to have like test/my-app and I have aws secrets manager configured "test/my-app" with parameters db.password, user.api.key, etc.. with this change I am getting below stack trace. Am I missing something here?

com.amazonaws.services.simplesystemsmanagement.model.AWSSimpleSystemsManagementException: The parameter doesn't meet the parameter name requirements. The parameter name must begin with a forward slash \"/\". It can't be prefixed with \\\"aws\\\" or \\\"ssm\\\" (case-insensitive). It must use only letters, numbers, or the following symbols: . (period), - (hyphen), _ (underscore). Special characters are not allowed. All sub-paths, if specified, must use the forward slash symbol \"/\". Valid example: /get/parameters2-/by1./path0_. (Service: AWSSimpleSystemsManagement; Status Code: 400; Error Code: ValidationException; Request ID: 879e932d-2fd3-4a75-a23f-44081cb2216b)\n\tat com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1695)\n\tat com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1350)\n\tat com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1101)\n\tat com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:758)\n\tat com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:732)\n\tat com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:714)\n\tat com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:674)\n\tat com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:656)\n\tat com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:520)\n\tat com.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagementClient.doInvoke(AWSSimpleSystemsManagementClient.java:8219)\n\tat com.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagementClient.invoke(AWSSimpleSystemsManagementClient.java:8186)\n\tat com.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagementClient.invoke(AWSSimpleSystemsManagementClient.java:8175)\n\tat com.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagementClient.executeGetParametersByPath(AWSSimpleSystemsManagementClient.java:5147)\n\tat com.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagementClient.getParametersByPath(AWSSimpleSystemsManagementClient.java:5119)\n\tat org.springframework.cloud.aws.paramstore.AwsParamStorePropertySource.getParameters(AwsParamStorePropertySource.java:67)\n\tat org.springframework.cloud.aws.paramstore.AwsParamStorePropertySource.init(AwsParamStorePropertySource.java:52)\n\tat org.springframework.cloud.aws.paramstore.AwsParamStorePropertySourceLocator.create(AwsParamStorePropertySourceLocator.java:111)\n\tat org.springframework.cloud.aws.paramstore.AwsParamStorePropertySourceLocator.locate(AwsParamStorePropertySourceLocator.java:94)\n\tat org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:94)\n\tat org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:628)\n\tat org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:364)\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:305)\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1242)\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:1230)\n\tat com.chegg.math.gateway.MathGatewayApplication.main(MathGatewayApplication.java:24)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:498)\n\tat org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)

venkatduddu commented 5 years ago

@jkuipers appreciate your inputs on this.

venkatduddu commented 5 years ago

i was confused with secret-manager and param-store.. i will have a look at secret-manager to clarify my doubts

jkuipers commented 5 years ago

Profile support is based on the same support in Spring Cloud Consul, so the same setup is used. That doesn’t allow profiles used as prefixes, so this code doesn’t either.

I don’t understand your second question: the value needs to start with a forward slash, yours doesn’t and the exception message clearly states the problem. So what’s the question exactly?