103 lines
30 KiB
HTML
103 lines
30 KiB
HTML
<html><head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>2. Basic setup</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="multi_spring-cloud-aws.html" title="Spring Cloud AWS"><link rel="up" href="multi_spring-cloud-aws.html" title="Spring Cloud AWS"><link rel="prev" href="multi__using_amazon_web_services.html" title="1. Using Amazon Web Services"><link rel="next" href="multi__cloud_environment.html" title="3. Cloud environment"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2. Basic setup</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__using_amazon_web_services.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__cloud_environment.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_basic_setup" href="#_basic_setup"></a>2. Basic setup</h1></div></div></div><p>Before using the Spring Cloud AWS module developers have to pick the dependencies and configure the Spring Cloud AWS module.
|
|
The next chapters describe the dependency management and also the basic configuration for the Spring AWS Cloud project.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_spring_cloud_aws_maven_dependency_management" href="#_spring_cloud_aws_maven_dependency_management"></a>2.1 Spring Cloud AWS maven dependency management</h2></div></div></div><p>Spring Cloud AWS module dependencies can be used directly in <a class="link" href="http://maven.apache.org" target="_top">Maven</a> with a direct configuration
|
|
of the particular module. The Spring Cloud AWS module includes all transitive dependencies for the Spring modules and
|
|
also the Amazon SDK that are needed to operate the modules. The general dependency configuration will look like this:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependencies></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.cloud<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-cloud-aws-context<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><version></span>{spring-cloud-version}<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></version></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependencies></span></pre><p>Different modules can be included by replacing the module name with the respective one (e.g. <code class="literal">spring-cloud-aws-messaging</code>
|
|
instead of <code class="literal">spring-cloud-aws-context</code>)</p><p>The example above works with the Maven Central repository. To use the Spring Maven repository (e.g. for milestones or
|
|
developer snapshots), you need to specify the repository location in your Maven configuration. For full releases:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><repositories></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><repository></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><id></span>io.spring.repo.maven.release<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></id></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><url></span>http://repo.spring.io/release/<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></url></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><snapshots></span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><enabled></span>false<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></enabled></span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></snapshots></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></repository></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></repositories></span></pre><p>For milestones:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><repositories></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><repository></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><id></span>io.spring.repo.maven.milestone<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></id></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><url></span>http://repo.spring.io/milestone/<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></url></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><snapshots></span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><enabled></span>false<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></enabled></span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></snapshots></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></repository></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></repositories></span></pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_amazon_sdk_configuration" href="#_amazon_sdk_configuration"></a>2.2 Amazon SDK configuration</h2></div></div></div><p>The Spring Cloud AWS configuration is currently done using custom elements provided by Spring Cloud AWS namespaces.
|
|
JavaConfig will be supported soon. The configuration setup is done directly in Spring XML configuration files
|
|
so that the elements can be directly used. Each module of Spring Cloud AWS provides custom namespaces to allow the modular
|
|
use of the modules. A typical XML configuration to use Spring Cloud AWS is outlined below:</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">xmlns</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://www.springframework.org/schema/beans"</span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xmlns:xsi</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://www.w3.org/2001/XMLSchema-instance"</span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xmlns:aws-context</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://www.springframework.org/schema/cloud/aws/context"</span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xsi:schemaLocation</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://www.springframework.org/schema/beans
|
|
http://www.springframework.org/schema/beans/spring-beans.xsd
|
|
http://www.springframework.org/schema/cloud/aws/context
|
|
http://www.springframework.org/schema/cloud/aws/context/spring-cloud-aws-context.xsd"</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-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, 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>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"><aws-context:context-credentials></span>
|
|
<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">"AKIAIO"</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">"wJalrXUtnFEMI/K7M"</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="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="images/caution.png"></td><th align="left">Caution</th></tr><tr><td align="left" valign="top"><p>The access-key and secret-key should be externalized into property files (e.g. Spring Boot application configuration)
|
|
and not be checked in into the source management system.</p></td></tr></table></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_instance_profile_configuration" href="#_instance_profile_configuration"></a>Instance profile configuration</h4></div></div></div><p>An <a class="link" href="http://docs.aws.amazon.com/IAM/latest/UserGuide/instance-profiles.html" target="_top">instance profile configuration</a> allows to assign
|
|
a profile that is authorized by a role while starting an EC2 instance. All calls made from the EC2 instance are then authenticated
|
|
with the instance profile specific user role. Therefore there is no dedicated access-key and secret-key needed in the configuration.
|
|
The configuration for the instance profile in Spring Cloud AWS 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>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"><aws-context:context-credentials></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"><aws-context:instance-profile-credentials/></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"></aws-context:context-credentials></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"></beans></span></pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_mixing_both_security_configurations" href="#_mixing_both_security_configurations"></a>Mixing both security configurations</h4></div></div></div><p>In some cases it is useful to combine both authentication strategies to allow the application to use the instance profile
|
|
with a fallback for an explicit access-key and secret-key configuration. This is useful if the application is tested inside
|
|
EC2 (e.g. on a test server) and locally for testing. The next snippet shows a combination of both security configurations.</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>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"><aws-context:context-credentials></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"><aws-context:instance-profile-credentials/></span>
|
|
<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 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>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"><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">"eu-west-1"</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="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>It is also allowed to use expressions or placeholders to externalize the configuration and ensure that the region can
|
|
be reconfigured with property files or system properties.</p></td></tr></table></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_automatic_region_configuration" href="#_automatic_region_configuration"></a>Automatic region configuration</h4></div></div></div><p>If the application context is started inside an EC2 instance, then the region can automatically be fetched from the
|
|
<a class="link" href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html" target="_top">instance metadata</a> and therefore must
|
|
not be configured statically. The configuration will look 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>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"><aws-context:context-region</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">auto-detect</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"true"</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><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_service_specific_region_configuration" href="#_service_specific_region_configuration"></a>Service specific region configuration</h4></div></div></div><p>A region can also be overridden for particular services if one application context consumes services from different regions.
|
|
The configuration can be done globally like described above and configured for each service with a region attribute.
|
|
The configuration might look like this for a database service (described later)</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>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"><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">"eu-central-1"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"> /></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><jdbc:data-source</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">...</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">"eu-west-1"</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="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>While it is theoretically possible to use multiple regions per application, we strongly recommend to write applications that
|
|
are hosted only inside one region and split the application if it is hosted in different regions at the same time.</p></td></tr></table></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_spring_boot_auto_configuration" href="#_spring_boot_auto_configuration"></a>2.2.3 Spring Boot auto-configuration</h3></div></div></div><p>Following the Spring Cloud umbrella project, Spring Cloud AWS also provides dedicated Spring Boot support. Spring Cloud
|
|
AWS can be configured using Spring Boot properties and will also automatically guess any sensible configuration based on
|
|
the general setup.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_maven_dependencies" href="#_maven_dependencies"></a>Maven dependencies</h4></div></div></div><p>Spring Cloud AWS provides a dedicated module to enable the Spring Boot support. That module must be added to the general
|
|
maven dependency inside the application. The typical configuration will look like this</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependencies></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.cloud<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-cloud-aws-autoconfigure<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><version></span>{spring-cloud-version}<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></version></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span>
|
|
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependencies></span></pre><p>Additional dependencies to enable particular features like messaging and JDBC have to be added. Spring Cloud AWS will
|
|
only configure classes that are available in the Spring Boot application’s classpath.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_configuring_credentials" href="#_configuring_credentials"></a>Configuring credentials</h4></div></div></div><p>Spring Boot provides a standard way to define properties with property file or YAML configuration files. Spring Cloud
|
|
AWS provides support to configure the credential information with the Spring Boot application configuration files.
|
|
Spring Cloud AWS provides the following properties to configure the credentials setup for the whole application.</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">example</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>cloud.aws.credentials.accessKey</p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>AKIAIOSFODNN7EXAMPLE</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The access key to be used with a static provider</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>cloud.aws.credentials.secretKey</p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The secret key to be used with a static provider</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>cloud.aws.credentials.instanceProfile</p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>true</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Configures an instance profile credentials provider with no further configuration</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p>cloud.aws.credentials.useDefaultAwsCredentialsChain</p></td><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p>true</p></td><td style="" align="left" valign="top"><p>Use the DefaultAWSCredentials Chain instead of configuring a custom credentials chain</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_configuring_region" href="#_configuring_region"></a>Configuring region</h4></div></div></div><p>Like for the credentials, the Spring Cloud AWS module also supports the configuration of the region inside the Spring
|
|
Boot configuration files. The region can be automatically detected or explicitly configured (e.g. in case of local tests
|
|
against the AWS cloud).</p><p>The properties to configure the region are shown below</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">example</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>cloud.aws.region.auto</p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>true</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Enables automatic region detection based on the EC2 meta data service</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p>cloud.aws.region.static</p></td><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p>eu-west-1</p></td><td style="" align="left" valign="top"><p>Configures a static region for the application. Possible regions are (currently) us-east-1, us-west-1, us-west-2,
|
|
eu-west-1, eu-central-1, ap-southeast-1, ap-southeast-1, ap-northeast-1, sa-east-1, cn-north-1 and any custom region
|
|
configured with own region meta data</p></td></tr></tbody></table></div></div></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__using_amazon_web_services.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__cloud_environment.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">1. Using Amazon Web Services </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"> 3. Cloud environment</td></tr></table></div></body></html> |