Update aws 2.0.0.RC2

This commit is contained in:
Dave Syer
2018-06-06 08:28:17 +01:00
parent a10f0e6331
commit 681ac1d2ba
6 changed files with 181 additions and 17 deletions

View File

@@ -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">&lt;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">/&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/beans&gt;</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&nbsp;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">&lt;beans</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">...&gt;</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">&lt;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">/&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/aws-context:context-credentials&gt;</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">&lt;/beans&gt;</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&nbsp;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&#8217;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&#8217;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&nbsp;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">&lt;beans</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">...&gt;</span>