

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 파라미터 스토어 구성
<a name="configure-store"></a>

Parameter Store는의 기능입니다 AWS Systems Manager. 구성 데이터 관리 및 암호 관리를 위한 안전한 계층적 스토리지를 제공합니다. 암호, 데이터베이스 문자열, Amazon Machine Image(AMI) ID 및 라이선스 코드와 같은 데이터를 파라미터 값으로 저장할 수 있습니다.

## .NET Framework 애플리케이션에서 Parameter Store를 사용하기 위한 사전 조건
<a name="configure-store-prereq"></a>
+ 활성 AWS 계정
+ [Microsoft Visual Studio](https://visualstudio.microsoft.com/downloads/), 설치됨
+ AWS Command Line Interface 에 AWS 계정 액세스하도록 설치 및 구성된 (AWS CLI) 버전 2([지침](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) 참조)
+ AWS Toolkit for Visual Studio, 구성됨([지침](https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/setup.html) 참조)
+ [Secrets Manager 콘솔 또는를 사용하여 생성된 Systems Manager](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-create-console.html) 파라미터 [AWS CLI](https://docs.aws.amazon.com/systems-manager/latest/userguide/param-create-cli.html)

## 예제
<a name="configure-store-example"></a>

ASP.NET Core 웹 애플리케이션 또는 API의 파라미터 스토어에서 값을 검색하려면:

1. ASP.NET Core 웹 API에 다음 NuGet 패키지를 추가합니다.

   ```
   Amazon.Extensions.Configuration.SystemsManager
   ```

1. `Program.cs` 파일에서 다음과 같이 변경합니다.
   + `using` 문(1)을 추가합니다.

     ```
     using Amazon;
     using Amazon.Extensions.NETCore.Setup;
     ```
   +  AWS Systems Manager 구성(2)을 추가합니다.

     ```
     builder.Configuration.AddSystemsManager("/dev/myapp", new AWSOptions
     {
         Region = RegionEndpoint.EUWest2
     });
     ```  
![\[Parameter Store에 액세스하기 위한 Program.cs 파일 변경 사항\]](http://docs.aws.amazon.com/ko_kr/prescriptive-guidance/latest/modernization-net-applications-security/images/ps-program-cs.png)
**참고**  
동적으로 또는 환경 변수()에서 `/myapp/dev` 및 `RegionEndPoint` 파라미터를 호출해야 합니다`Region = RegionEndpoint.GetBySystemName("eu-west-2")`. 프로덕션 환경에서 이러한 값을 하드코딩하지 마십시오.

1. 새 클래스 파일을 생성하고 이름을 로 지정합니다`ParameterOptions.cs`. 파일을 열고 다음 코드를 추가합니다.

   ```
   public class ParameterOptions
       {
           public const string ParameterName = "Tenant";
           public string key1 { get; set; } = string.Empty;
           public string key2 { get; set; } = string.Empty;
       }
   ```

1. Parameter Store에서 값을 검색하려면 컨트롤러 클래스 파일(예: `ValuesController.cs`)을 다음과 같이 변경합니다.
   + 생성자(1)를 추가합니다.

     ```
     private readonly IConfiguration _configuration;
     public ParametersController(IConfiguration configuration)
     {
         _configuration = configuration;
     }
     ```
   + Parameter Store(2)에서 값을 검색합니다.

     ```
     var parameterOptions = new ParameterOptions();
     _configuration.GetSection(ParameterOptions.ParameterName).Bind(parameterOptions);
     
     return new string[] {
         parameterOptions.key1,
         parameterOptions.key2
     };
     ```  
![\[Parameter Store에서 값을 검색하기 위한 컨트롤러 클래스 파일 변경\]](http://docs.aws.amazon.com/ko_kr/prescriptive-guidance/latest/modernization-net-applications-security/images/ps-controller-class.png)

## 리소스
<a name="configure-store-resources"></a>
+ [AWS Secrets Manager 교체 Lambda 함수](https://github.com/aws-samples/aws-secrets-manager-rotation-lambdas)(GitHub 리포지토리)
+ [AWS Systems Manager용 .NET 구성 확장, 샘플 폴더](https://github.com/aws/aws-dotnet-extensions-configuration/tree/master/samples/Samples)(GitHub 리포지토리)
+ [.NET에서 Secrets Manager 클라이언트 측 캐싱을 사용하는 방법](https://aws.amazon.com/blogs/security/how-to-use-aws-secrets-manager-client-side-caching-in-dotnet/)(AWS 보안 블로그)