Showing posts with label Config. Show all posts
Showing posts with label Config. Show all posts

Wednesday, June 23, 2021

AWS Configure : .aws : credentials : config :role_Arn : source_profile: credential_source

https://docs.aws.amazon.com/cli/latest/topic/config-vars.html#the-shared-credentials-file


%UserProfile%/.aws                 [Windows]

~/.aws                                     [Linux]


All these defaults can be changed too


aws configure       [Command to add Secret Key/Access Key using command Line itself]


role_arn and either a source_profile or a credential_source.





  • Shared Credentials File
  • AWS CLI Conflig File

They both contain Access_Key and Secret_Key

"CLI Config File" - access/Secret Keys are specific to that role
while


The shared credentials file has a default location of ~/.aws/credentials. 

You can change the location of the shared credentials file by setting the AWS_SHARED_CREDENTIALS_FILE environment variable.



The AWS CLI config file, which defaults to ~/.aws/config has the following format:

[default]

aws_access_key_id=foo

aws_secret_access_key=bar

region=us-west-2

Profiles that aren't the default profile are specified by creating a section titled "profile profilename":

[profile testing]

aws_access_key_id=foo

aws_secret_access_key=bar

region=us-west-2



aws_access_key_id, aws_secret_access_key, aws_session_token. These are the only supported values in the shared credential file. Also note that the section names are different than the AWS CLI config file (~/.aws/config). In the AWS CLI config file, you create a new profile by creating a section of [profile profile-name], for example:


[profile development]

aws_access_key_id=foo

aws_secret_access_key=bar

In the shared credentials file, profiles are not prefixed with profile, for example:


[development]

aws_access_key_id=foo

aws_secret_access_key=bar





Credentials specified in the shared credentials file have precedence over credentials in the AWS CLI config file

Shared Credentials File > Config File




Precedence

The above configuration values have the following precedence:

  • Command line options
  • Environment variables
  • Configuration file



Credentials can be specified in several ways:

  • Environment variables
  • The AWS Shared Credential File
  • The AWS CLI config file

Sunday, April 18, 2021

Javabrains POC - Microservices - Part 2 [ Netflix OSS]

https://jsonplaceholder.typicode.com/posts/


https://spring.io/projects/spring-cloud-netflix

Spring Cloud Azure
Spring Cloud for Amazon Web Services
Spring Cloud GCP
Spring Cloud Netflix [Ribbon, Feign, Eureka]
Spring Cloud Kubernetes
Spring Cloud Gateway
Spring Cloud Circuit Breaker
Spring Cloud Config
Spring Cloud OpenFeign
Spring Cloud Consul
Spring Cloud Vault
Spring Cloud Zookeeper

Spring Cloud Netflix OSS 
Feign - Declarative HTTP Client
Eureka - Service Register and Discovery
Ribbon - Client Side Load Balancing
Hytrix - Fault Tolerance Library

Spring Cloud Netflix features:

  • Service Discovery: Eureka instances can be registered and clients can discover the instances using Spring-managed beans

  • Service Discovery: an embedded Eureka server can be created with declarative Java configuration

  • Circuit Breaker: Hystrix clients can be built with a simple annotation-driven method decorator

  • Circuit Breaker: embedded Hystrix dashboard with declarative Java configuration

  • Declarative REST Client: Feign creates a dynamic implementation of an interface decorated with JAX-RS or Spring MVC annotations

  • Client Side Load Balancer: Ribbon

  • External Configuration: a bridge from the Spring Environment to Archaius (enables native configuration of Netflix components using Spring Boot conventions)

  • Router and Filter: automatic registration of Zuul filters, and a simple convention over configuration approach to reverse proxy creation


-----------------------------------------------------------------------------------------------------------


Release TrainBoot Version

2020.0.x aka Ilford

2.4.x

Hoxton

2.2.x, 2.3.x (Starting with SR5)

Greenwich

2.1.x

Finchley

2.0.x

Edgware

1.5.x

Dalston

1.5.x


<dependency>
   <groupId>org.springframework.cloud</groupId>
   <artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</dependency>

This is happening because http://microservice_provider_user/ is not a legal host name.

Don't use Underscore for Hostnames


Using Ribbon with Eureka
Use Ribbon Without Eureka
----------------------------------------------------------------------------------------------------------------
Feign

----------------------------------------------------------------------------------------------------------------


----------------------------------------------------------------------------------------------------------------


Tuesday, January 19, 2021

Externalisation of Configuration - Spring Boot --spring.config.location --spring.config.additional-location

https://www.baeldung.com/spring-properties-file-outside-jar

https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html

----------------------------------------------------------------------------

By default, Spring Boot looks for "application.properties", "application.yml" inside
locations defined by "spring.config.location" Application Java Arguments

Note :
-Dfoo.bar=fubar (JVM Arg) (-D)
--foo.bar=fubar (Application Arg) (--)

If If you prefer to add additional locations, rather than replacing them, you can use "spring.config.additional-location"

Spring Boot - will look for Files in these config Locations apart from Usual Config Directories inside the Project and read them and Will be used to fill Values from @Value Annotations at Startup 

@Configuration
public class SystemPropertiesFilepaths {

	@Value("${applicationProperties}")
	private String applicationProperties;

	@Value("${processDetails}")
	private String processDetails;

	@Value("${databaseProperties}")
	private String databaseProperties;
}
  //Getters or Field Level Accessors used to fetch Values 

----------------------------------------------------------------------------

export SPRING_CONFIG_NAME=application,jdbc export SPRING_CONFIG_LOCATION=file:///Users/home/config

java -jar app.jar --spring.config.name=application,jdbc --spring.config.location=file:///Users/home/config

----------------------------------------------------------------------------

Using the Default Location

By convention, Spring Boot looks for an externalized configuration file – application.properties or application.yml – in 4 predetermined locations in the following order of precedence:

  • /config subdirectory of the current directory

Using the Command Line

We can also pass a folder location where the application will search for the file:

java -jar app.jar --spring.config.name=application,jdbc --spring.config.location=file:///Users/home/config


Using Environment Variables

Or, let's say that we can't alter the start-up command. What's great is Spring Boot will also read the environment variables SPRING_CONFIG_NAME and SPRING_CONFIG_LOCATION

export SPRING_CONFIG_NAME=application,jdbc
export SPRING_CONFIG_LOCATION=file:///Users/home/config
java -jar app.jar


2.3. External Application Properties

Spring Boot will automatically find and load application.properties and application.yaml files from the following locations when your application starts:

  1. The classpath root

  2. The classpath /config package

  3. The current directory

  4. The /config subdirectory in the current directory

  5. Immediate child directories of the /config subdirectory

The list is ordered by precedence (with values from lower items overriding earlier ones). Documents from the loaded files are added as PropertySources to the Spring Environment.

If you do not like application as the configuration file name, you can switch to another file name by specifying a spring.config.name environment property. You can also refer to an explicit location by using the spring.config.location environment property (which is a comma-separated list of directory locations or file paths). The following example shows how to specify a different file name:

$ java -jar myproject.jar --spring.config.name=myproject

The following example shows how to specify two locations:

$ java -jar myproject.jar --spring.config.location=optional:classpath:/default.properties,optional:classpath:/override.properties
Use the prefix optional: if the locations are optional and you don’t mind if they don’t exist.
spring.config.name and spring.config.location are used very early to determine which files have to be loaded. They must be defined as an environment property (typically an OS environment variable, a system property, or a command-line argument).

If spring.config.location contains directories (as opposed to files), they should end in / (at runtime they will be appended with the names generated from spring.config.name before being loaded). Files specified in spring.config.location are used as-is. Whether specified directly or contained in a directory, configuration files must include a file extension in their name. Typical extensions that are supported out-of-the-box are .properties.yaml, and .yml.

When multiple locations are specified, the later ones can override the values of earlier ones.

Locations configured by using spring.config.location replace the default locations. For example, if spring.config.location is configured with the value optional:classpath:/custom-config/,optional:file:./custom-config/, the complete set of locations considered is:

  1. optional:classpath:custom-config/

  2. optional:file:./custom-config/

If you prefer to add additional locations, rather than replacing them, you can use spring.config.additional-location. Properties loaded from additional locations can override those in the default locations. For example, if spring.config.additional-location is configured with the value optional:classpath:/custom-config/,optional:file:./custom-config/, the complete set of locations considered is:

  1. optional:classpath:/

  2. optional:classpath:/config/

  3. optional:file:./

  4. optional:file:./config/

  5. optional:file:./config/*/

  6. optional:classpath:custom-config/

  7. optional:file:./custom-config/

This search ordering lets you specify default values in one configuration file and then selectively override those values in another. You can provide default values for your application in application.properties (or whatever other basename you choose with spring.config.name) in one of the default locations. These default values can then be overridden at runtime with a different file located in one of the custom locations.

Azure - Pipeline - Add Approver for Stage

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass