Giriş
SpringCloud AWS Secrets Manager kullanımına çok benziyor
Maven
Şu satırı dahil ederiz
<dependencyManagement> <dependencies> <dependency> <groupId>io.awspring.cloud</groupId> <artifactId>spring-cloud-aws-dependencies</artifactId> <version>3.0.1</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependency> <groupId>io.awspring.cloud</groupId> <artifactId>spring-cloud-aws-starter-parameter-store</artifactId> </dependency>
IAM Permissions
Açıklaması şöyle
For access, IAM permissions can be set up. The required Spring Cloud AWS permission is: ssm:GetParameters
Şöyle yaparız
Sample IAM policy granting access to Parameter Store: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "ssm:GetParametersByPath", "Resource": "*" } ] }
application.yaml Dosyası
Açıklaması şöyle
spring.config.import property is used to fetch parameters from AWS Parameter Store and add them to Spring’s environment properties.
Örnek
Şöyle yaparız
spring: profiles: active: dev application: name: my-demo-boot # AWS parameter store configuration cloud: aws: credentials: access-key: <your-access-key> secret-key: <your-secret-key> profile: name: default region: static: us-east-2 config: import: - aws-parameterstore:/config/application_${spring.profiles.active}/ # actuator configuration management: endpoints: enabled-by-default: false web: exposure: include: 'health, env' endpoint: health: enabled: true show-details: always env: enabled: true
Hiç yorum yok:
Yorum Gönder