Update aws 2.0.0.RC2
This commit is contained in:
@@ -37,9 +37,9 @@ use of the modules. A typical XML configuration to use Spring Cloud AWS is outli
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><aws-context:context-region</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">region</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"..."</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">/></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></beans></span></pre><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_sdk_credentials_configuration" href="#_sdk_credentials_configuration"></a>2.2.1 SDK credentials configuration</h3></div></div></div><p>In order to make calls to the Amazon Web Service the credentials must be configured for the the Amazon SDK. Spring Cloud AWS
|
||||
provides support to configure an application context specific credentials that are used for <span class="emphasis"><em>each</em></span> service call for requests done
|
||||
by Spring Cloud AWS components. Therefore there must be <span class="strong"><strong>exactly one</strong></span> configuration of the credentials for an entire application
|
||||
context.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>The <code class="literal">com.amazonaws.auth.DefaultAWSCredentialsProviderChain</code> is used by all the clients if there is no dedicated credentials
|
||||
provider defined. This will essentially use the following authentication information</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">use the environment variables <code class="literal">AWS_ACCESS_KEY_ID</code> and <code class="literal">AWS_SECRET_ACCESS_KEY</code></li><li class="listitem">use the system properties <code class="literal">aws.accessKeyId</code> and <code class="literal">aws.secretKey</code></li><li class="listitem">use the user specific profile credentials file</li><li class="listitem">use the instance profile credentials (see below)</li></ul></div></td></tr></table></div><p>Based on the overall credentials policy there are different options to configure the credentials. The possible ones are described in
|
||||
by Spring Cloud AWS components, with the exception of the Parameter Store Configuration.
|
||||
Therefore there must be <span class="strong"><strong>exactly one</strong></span> configuration of the credentials for an entire application context.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>The <code class="literal">com.amazonaws.auth.DefaultAWSCredentialsProviderChain</code> is used by all the clients if there is no dedicated credentials
|
||||
provider defined. This will essentially use the following authentication information</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">use the environment variables <code class="literal">AWS_ACCESS_KEY_ID</code> and <code class="literal">AWS_SECRET_ACCESS_KEY</code></li><li class="listitem">use the system properties <code class="literal">aws.accessKeyId</code> and <code class="literal">aws.secretKey</code></li><li class="listitem">use the user specific profile credentials file</li><li class="listitem">use ECS credentials if the <code class="literal">AWS_CONTAINER_CREDENTIALS_RELATIVE_URI</code> environment variable is set</li><li class="listitem">use the instance profile credentials (see below)</li></ul></div></td></tr></table></div><p>Based on the overall credentials policy there are different options to configure the credentials. The possible ones are described in
|
||||
the following sub-chapters.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_simple_credentials_configuration" href="#_simple_credentials_configuration"></a>Simple credentials configuration</h4></div></div></div><p>Credentials for the Amazon SDK consist of an access key (which might be shared) and a secret key (which must <span class="strong"><strong>not</strong></span> be shared). Both
|
||||
security attributes can be configured using the XML namespaces for each Amazon SDK service created by the Spring Cloud AWS
|
||||
module. The overall configuration looks like this</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><beans</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">...></span>
|
||||
@@ -62,7 +62,13 @@ EC2 (e.g. on a test server) and locally for testing. The next snippet shows a co
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"><aws-context:simple-credentials</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">access-key</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"${accessKey:}"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">secret-key</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"${secretKey:}"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">/></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></aws-context:context-credentials></span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></beans></span></pre><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>The access-key and secret-key are defined using a placeholder expressions along with a default value to avoid bootstrap
|
||||
errors if the properties are not configured at all.</p></td></tr></table></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_region_configuration" href="#_region_configuration"></a>2.2.2 Region configuration</h3></div></div></div><p>Amazon Web services are available in different <a class="link" href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html" target="_top">regions</a>. Based
|
||||
errors if the properties are not configured at all.</p></td></tr></table></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_parameter_store_configuration_credentials_and_region_configuration" href="#_parameter_store_configuration_credentials_and_region_configuration"></a>Parameter Store Configuration credentials and region configuration</h4></div></div></div><p>The Parameter Store Configuration support uses a bootstrap context to configure a default <code class="literal">AWSSimpleSystemsManagement</code>
|
||||
client, which uses a <code class="literal">com.amazonaws.auth.DefaultAWSCredentialsProviderChain</code> and <code class="literal">com.amazonaws.regions.DefaultAwsRegionProviderChain</code>.
|
||||
If you want to override this, then you need to
|
||||
<a class="link" href="http://cloud.spring.io/spring-cloud-static/Edgware.SR2/multi/multi__spring_cloud_context_application_context_services.html#_customizing_the_bootstrap_configuration" target="_top">define your own Spring Cloud bootstrap configuration class</a>
|
||||
with a bean of type <code class="literal">AWSSimpleSystemsManagement</code> that’s configured to use your chosen credentials and/or region provider.
|
||||
Because this context is created when your Spring Cloud Bootstrap context is created, you can’t simply override the bean
|
||||
in a regular <code class="literal">@Configuration</code> class.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_region_configuration" href="#_region_configuration"></a>2.2.2 Region configuration</h3></div></div></div><p>Amazon Web services are available in different <a class="link" href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html" target="_top">regions</a>. Based
|
||||
on the custom requirements, the user can host the application on different Amazon regions. The <code class="literal">spring-cloud-aws-context</code>
|
||||
module provides a way to define the region for the entire application context.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_explicit_region_configuration" href="#_explicit_region_configuration"></a>Explicit region configuration</h4></div></div></div><p>The region can be explicitly configured using an XML element. This is particularly useful if the region can not be automatically
|
||||
derived because the application is not hosted on a EC2 instance (e.g. local testing) or the region must be manually overridden.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><beans</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">...></span>
|
||||
|
||||
@@ -135,4 +135,18 @@ the specified region and security credentials. Application developers can inject
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> ApplicationService(AmazonEC2 amazonEc2) {
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">this</span>.amazonEc2 = amazonEc2;
|
||||
}
|
||||
}</pre></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__basic_setup.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__managing_cloud_environments.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2. Basic setup </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-aws.html">Home</a></td><td width="40%" align="right" valign="top"> 4. Managing cloud environments</td></tr></table></div></body></html>
|
||||
}</pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_integrating_your_spring_cloud_application_with_the_aws_parameter_store" href="#_integrating_your_spring_cloud_application_with_the_aws_parameter_store"></a>3.2 Integrating your Spring Cloud application with the AWS Parameter Store</h2></div></div></div><p>Spring Cloud provides support for centralized configuration, which can be read and made available as a regular Spring
|
||||
<code class="literal">PropertySource</code> when the application is started. The Parameter Store Configuration allows you to use this mechanism
|
||||
with the <a class="link" href="https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-paramstore.html" target="_top">AWS Parameter Store</a>.</p><p>Simply add a dependency on the <code class="literal">spring-cloud-starter-aws-parameter-store-config</code> starter module to activate the support.
|
||||
The support is similar to the support provided for the Spring Cloud Config Server or Consul’s key-value store:
|
||||
configuration parameters can be defined to be shared across all services or for a specific service and can be
|
||||
profile-specific. Encrypted values will be decrypted when retrieved.</p><p>All configuration parameters are retrieved from a common path prefix, which defaults to <code class="literal">/config</code>. From there shared
|
||||
parameters are retrieved from a path that defaults to <code class="literal">application</code> and service-specific parameters use a path that
|
||||
defaults to the configured <code class="literal">spring.application.name</code>. You can use both dots and forward slashes to specify the names
|
||||
of configuration keys. Names of activated profiles will be appended to the path using a separator that defaults to an
|
||||
underscore.</p><p>That means that for a service called <code class="literal">my-service</code> the module by default would find and use these parameters:</p><div class="informaltable"><table style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">parameter key</th><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Spring property</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">description</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">/config/application/cloud.aws.stack.name</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">cloud.aws.stack.name</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Shared by all services that have the Configuration support enabled. Can be overridden with a service- or profile-specific property.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">/config/application_production/cloud.aws.stack.name</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">cloud.aws.stack.name</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Shared by all services that have the Configuration support enabled and have a <code class="literal">production</code> Spring profile activated.
|
||||
Can be overridden with a service-specific property.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">/config/my-service/cloud/aws/stack/auto</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">cloud.aws.stack.auto</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Specific to the <code class="literal">my-service</code> service. Note that slashes in the key path are replaced with dots.</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">/config/my-service_production/cloud/aws/stack/auto</code></p></td><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">cloud.aws.stack.auto</code></p></td><td style="" align="left" valign="top"><p>Specific to the <code class="literal">my-service</code> service when a <code class="literal">production</code> Spring profile is activated.</p></td></tr></tbody></table></div><p>Note that this module does not support full configuration files to be used as parameter values like e.g. Spring Cloud Consul does:
|
||||
AWS parameter values are limited to 4096 characters, so we support individual Spring properties to be configured only.</p><p>You can configure the following settings in a Spring Cloud <code class="literal">bootstrap.properties</code> or <code class="literal">bootstrap.yml</code> file
|
||||
(note that relaxed property binding is applied, so you don’t have to use this exact syntax):</p><div class="informaltable"><table style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">property</th><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">default</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">explanation</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">aws.paramstore.prefix</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">/config</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Prefix indicating first level for every property loaded from the Parameter Store.
|
||||
Value must start with a forward slash followed by one or more valid path segments or be empty.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">aws.paramstore.defaultContext</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">application</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Name of the context that defines properties shared across all services</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">aws.paramstore.profileSeparator</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">_</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>String that separates an appended profile from the context name. Note that an AWS parameter key can only contain
|
||||
dots, dashes and underscores next to alphanumeric characters.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">aws.paramstore.failFast</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">true</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Indicates if an error while retrieving the parameters should fail starting the application.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">aws.paramstore.name</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>the configured value for <code class="literal">spring.application.name</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Name to use when constructing the path for the properties to look up for this specific service.</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">aws.paramstore.enabled</code></p></td><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">true</code></p></td><td style="" align="left" valign="top"><p>Can be used to disable the Parameter Store Configuration support even though the auto-configuration is on the classpath.</p></td></tr></tbody></table></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__basic_setup.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__managing_cloud_environments.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2. Basic setup </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-aws.html">Home</a></td><td width="40%" align="right" valign="top"> 4. Managing cloud environments</td></tr></table></div></body></html>
|
||||
@@ -14,4 +14,5 @@ resource loader abstraction. Moreover developers can send e-mails using the <a c
|
||||
and the Spring mail abstraction. Further the developers can introduce declarative caching using the Spring caching support
|
||||
and the <a class="link" href="http://aws.amazon.com/elasticache/" target="_top">ElastiCache</a> caching service.</li><li class="listitem"><span class="strong"><strong>Spring Cloud AWS JDBC</strong></span> provides automatic datasource lookup and configuration for the <a class="link" href="http://aws.amazon.com/rds/" target="_top">Relational Database Service</a>
|
||||
which can be used with JDBC or any other support data access technology by Spring.</li><li class="listitem"><span class="strong"><strong>Spring Cloud AWS Messaging</strong></span> enables developers to receive and send messages with the <a class="link" href="http://aws.amazon.com/sqs/" target="_top">Simple Queueing Service</a> for
|
||||
point-to-point communication. Publish-subscribe messaging is supported with the integration of the <a class="link" href="http://aws.amazon.com/sns/" target="_top">Simple Notification Service</a>.</li></ul></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi_pr01.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__basic_setup.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-aws.html">Home</a></td><td width="40%" align="right" valign="top"> 2. Basic setup</td></tr></table></div></body></html>
|
||||
point-to-point communication. Publish-subscribe messaging is supported with the integration of the <a class="link" href="http://aws.amazon.com/sns/" target="_top">Simple Notification Service</a>.</li><li class="listitem"><span class="strong"><strong>Spring Cloud AWS Parameter Store Configuration</strong></span> enables Spring Cloud applications to use the <a class="link" href="https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-paramstore.html" target="_top">AWS Parameter Store</a>
|
||||
as a Bootstrap Property Source, comparable to the support provided for the Spring Cloud Config Server or Consul’s key-value store.</li></ul></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi_pr01.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__basic_setup.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-aws.html">Home</a></td><td width="40%" align="right" valign="top"> 2. Basic setup</td></tr></table></div></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -4,7 +4,7 @@
|
||||
<book xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en">
|
||||
<info>
|
||||
<title>Spring Cloud AWS</title>
|
||||
<date>2018-05-24</date>
|
||||
<date>2018-06-06</date>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<personname>
|
||||
@@ -65,6 +65,10 @@ which can be used with JDBC or any other support data access technology by Sprin
|
||||
<simpara><emphasis role="strong">Spring Cloud AWS Messaging</emphasis> enables developers to receive and send messages with the <link xl:href="http://aws.amazon.com/sqs/">Simple Queueing Service</link> for
|
||||
point-to-point communication. Publish-subscribe messaging is supported with the integration of the <link xl:href="http://aws.amazon.com/sns/">Simple Notification Service</link>.</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara><emphasis role="strong">Spring Cloud AWS Parameter Store Configuration</emphasis> enables Spring Cloud applications to use the <link xl:href="https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-paramstore.html">AWS Parameter Store</link>
|
||||
as a Bootstrap Property Source, comparable to the support provided for the Spring Cloud Config Server or Consul’s key-value store.</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</chapter>
|
||||
<chapter xml:id="_basic_setup">
|
||||
@@ -123,8 +127,8 @@ use of the modules. A typical XML configuration to use Spring Cloud AWS is outli
|
||||
<title>SDK credentials configuration</title>
|
||||
<simpara>In order to make calls to the Amazon Web Service the credentials must be configured for the the Amazon SDK. Spring Cloud AWS
|
||||
provides support to configure an application context specific credentials that are used for <emphasis>each</emphasis> service call for requests done
|
||||
by Spring Cloud AWS components. Therefore there must be <emphasis role="strong">exactly one</emphasis> configuration of the credentials for an entire application
|
||||
context.</simpara>
|
||||
by Spring Cloud AWS components, with the exception of the Parameter Store Configuration.
|
||||
Therefore there must be <emphasis role="strong">exactly one</emphasis> configuration of the credentials for an entire application context.</simpara>
|
||||
<tip>
|
||||
<simpara>The <literal>com.amazonaws.auth.DefaultAWSCredentialsProviderChain</literal> is used by all the clients if there is no dedicated credentials
|
||||
provider defined. This will essentially use the following authentication information</simpara>
|
||||
@@ -139,6 +143,9 @@ context.</simpara>
|
||||
<simpara>use the user specific profile credentials file</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>use ECS credentials if the <literal>AWS_CONTAINER_CREDENTIALS_RELATIVE_URI</literal> environment variable is set</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>use the instance profile credentials (see below)</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@@ -188,6 +195,16 @@ EC2 (e.g. on a test server) and locally for testing. The next snippet shows a co
|
||||
errors if the properties are not configured at all.</simpara>
|
||||
</tip>
|
||||
</section>
|
||||
<section xml:id="_parameter_store_configuration_credentials_and_region_configuration">
|
||||
<title>Parameter Store Configuration credentials and region configuration</title>
|
||||
<simpara>The Parameter Store Configuration support uses a bootstrap context to configure a default <literal>AWSSimpleSystemsManagement</literal>
|
||||
client, which uses a <literal>com.amazonaws.auth.DefaultAWSCredentialsProviderChain</literal> and <literal>com.amazonaws.regions.DefaultAwsRegionProviderChain</literal>.
|
||||
If you want to override this, then you need to
|
||||
<link xl:href="http://cloud.spring.io/spring-cloud-static/Edgware.SR2/multi/multi__spring_cloud_context_application_context_services.html#_customizing_the_bootstrap_configuration">define your own Spring Cloud bootstrap configuration class</link>
|
||||
with a bean of type <literal>AWSSimpleSystemsManagement</literal> that’s configured to use your chosen credentials and/or region provider.
|
||||
Because this context is created when your Spring Cloud Bootstrap context is created, you can’t simply override the bean
|
||||
in a regular <literal>@Configuration</literal> class.</simpara>
|
||||
</section>
|
||||
</section>
|
||||
<section xml:id="_region_configuration">
|
||||
<title>Region configuration</title>
|
||||
@@ -547,6 +564,111 @@ the specified region and security credentials. Application developers can inject
|
||||
}</programlisting>
|
||||
</section>
|
||||
</section>
|
||||
<section xml:id="_integrating_your_spring_cloud_application_with_the_aws_parameter_store">
|
||||
<title>Integrating your Spring Cloud application with the AWS Parameter Store</title>
|
||||
<simpara>Spring Cloud provides support for centralized configuration, which can be read and made available as a regular Spring
|
||||
<literal>PropertySource</literal> when the application is started. The Parameter Store Configuration allows you to use this mechanism
|
||||
with the <link xl:href="https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-paramstore.html">AWS Parameter Store</link>.</simpara>
|
||||
<simpara>Simply add a dependency on the <literal>spring-cloud-starter-aws-parameter-store-config</literal> starter module to activate the support.
|
||||
The support is similar to the support provided for the Spring Cloud Config Server or Consul’s key-value store:
|
||||
configuration parameters can be defined to be shared across all services or for a specific service and can be
|
||||
profile-specific. Encrypted values will be decrypted when retrieved.</simpara>
|
||||
<simpara>All configuration parameters are retrieved from a common path prefix, which defaults to <literal>/config</literal>. From there shared
|
||||
parameters are retrieved from a path that defaults to <literal>application</literal> and service-specific parameters use a path that
|
||||
defaults to the configured <literal>spring.application.name</literal>. You can use both dots and forward slashes to specify the names
|
||||
of configuration keys. Names of activated profiles will be appended to the path using a separator that defaults to an
|
||||
underscore.</simpara>
|
||||
<simpara>That means that for a service called <literal>my-service</literal> the module by default would find and use these parameters:</simpara>
|
||||
<informaltable frame="all" rowsep="1" colsep="1">
|
||||
<tgroup cols="3">
|
||||
<colspec colname="col_1" colwidth="33.3333*"/>
|
||||
<colspec colname="col_2" colwidth="33.3333*"/>
|
||||
<colspec colname="col_3" colwidth="33.3334*"/>
|
||||
<thead>
|
||||
<row>
|
||||
<entry align="left" valign="top">parameter key</entry>
|
||||
<entry align="left" valign="top">Spring property</entry>
|
||||
<entry align="left" valign="top">description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara><literal>/config/application/cloud.aws.stack.name</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>cloud.aws.stack.name</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Shared by all services that have the Configuration support enabled. Can be overridden with a service- or profile-specific property.</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara><literal>/config/application_production/cloud.aws.stack.name</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>cloud.aws.stack.name</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Shared by all services that have the Configuration support enabled and have a <literal>production</literal> Spring profile activated.
|
||||
Can be overridden with a service-specific property.</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara><literal>/config/my-service/cloud/aws/stack/auto</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>cloud.aws.stack.auto</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Specific to the <literal>my-service</literal> service. Note that slashes in the key path are replaced with dots.</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara><literal>/config/my-service_production/cloud/aws/stack/auto</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>cloud.aws.stack.auto</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Specific to the <literal>my-service</literal> service when a <literal>production</literal> Spring profile is activated.</simpara></entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<simpara>Note that this module does not support full configuration files to be used as parameter values like e.g. Spring Cloud Consul does:
|
||||
AWS parameter values are limited to 4096 characters, so we support individual Spring properties to be configured only.</simpara>
|
||||
<simpara>You can configure the following settings in a Spring Cloud <literal>bootstrap.properties</literal> or <literal>bootstrap.yml</literal> file
|
||||
(note that relaxed property binding is applied, so you don’t have to use this exact syntax):</simpara>
|
||||
<informaltable frame="all" rowsep="1" colsep="1">
|
||||
<tgroup cols="3">
|
||||
<colspec colname="col_1" colwidth="33.3333*"/>
|
||||
<colspec colname="col_2" colwidth="33.3333*"/>
|
||||
<colspec colname="col_3" colwidth="33.3334*"/>
|
||||
<thead>
|
||||
<row>
|
||||
<entry align="left" valign="top">property</entry>
|
||||
<entry align="left" valign="top">default</entry>
|
||||
<entry align="left" valign="top">explanation</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara><literal>aws.paramstore.prefix</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>/config</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Prefix indicating first level for every property loaded from the Parameter Store.
|
||||
Value must start with a forward slash followed by one or more valid path segments or be empty.</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara><literal>aws.paramstore.defaultContext</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>application</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Name of the context that defines properties shared across all services</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara><literal>aws.paramstore.profileSeparator</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>_</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>String that separates an appended profile from the context name. Note that an AWS parameter key can only contain
|
||||
dots, dashes and underscores next to alphanumeric characters.</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara><literal>aws.paramstore.failFast</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>true</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Indicates if an error while retrieving the parameters should fail starting the application.</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara><literal>aws.paramstore.name</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>the configured value for <literal>spring.application.name</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Name to use when constructing the path for the properties to look up for this specific service.</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara><literal>aws.paramstore.enabled</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara><literal>true</literal></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Can be used to disable the Parameter Store Configuration support even though the auto-configuration is on the classpath.</simpara></entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</section>
|
||||
</chapter>
|
||||
<chapter xml:id="_managing_cloud_environments">
|
||||
<title>Managing cloud environments</title>
|
||||
|
||||
Reference in New Issue
Block a user