AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Container for the parameters to the AssociateKmsKey operation. Associates the specified KMS key with either one log group in the account, or with all stored CloudWatch Logs query insights results in the account.

When you use AssociateKmsKey, you specify either the logGroupName parameter or the resourceIdentifier parameter. You can't specify both of those parameters in the same operation.

If you delete the key that is used to encrypt log events or log group query results, then all the associated stored log events or query results that were encrypted with that key will be unencryptable and unusable.

CloudWatch Logs supports only symmetric KMS keys. Do not use an associate an asymmetric KMS key with your log group or query results. For more information, see Using Symmetric and Asymmetric Keys.

It can take up to 5 minutes for this operation to take effect.

If you attempt to associate a KMS key with a log group but the KMS key does not exist or the KMS key is disabled, you receive an InvalidParameterException error.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.CloudWatchLogs.AmazonCloudWatchLogsRequest
      Amazon.CloudWatchLogs.Model.AssociateKmsKeyRequest

Namespace: Amazon.CloudWatchLogs.Model
Assembly: AWSSDK.CloudWatchLogs.dll
Version: 3.x.y.z

Syntax

C#
public class AssociateKmsKeyRequest : AmazonCloudWatchLogsRequest
         IAmazonWebServiceRequest

The AssociateKmsKeyRequest type exposes the following members

Constructors

NameDescription
Public Method AssociateKmsKeyRequest()

Properties

NameTypeDescription
Public Property KmsKeyId System.String

Gets and sets the property KmsKeyId.

The Amazon Resource Name (ARN) of the KMS key to use when encrypting log data. This must be a symmetric KMS key. For more information, see Amazon Resource Names and Using Symmetric and Asymmetric Keys.

Public Property LogGroupName System.String

Gets and sets the property LogGroupName.

The name of the log group.

In your AssociateKmsKey operation, you must specify either the resourceIdentifier parameter or the logGroup parameter, but you can't specify both.

Public Property ResourceIdentifier System.String

Gets and sets the property ResourceIdentifier.

Specifies the target for this operation. You must specify one of the following:

  • Specify the following ARN to have future GetQueryResults operations in this account encrypt the results with the specified KMS key. Replace REGION and ACCOUNT_ID with your Region and account ID.

    arn:aws:logs:REGION:ACCOUNT_ID:query-result:*

  • Specify the ARN of a log group to have CloudWatch Logs use the KMS key to encrypt log events that are ingested and stored by that log group. The log group ARN must be in the following format. Replace REGION and ACCOUNT_ID with your Region and account ID.

    arn:aws:logs:REGION:ACCOUNT_ID:log-group:LOG_GROUP_NAME

In your AssociateKmsKey operation, you must specify either the resourceIdentifier parameter or the logGroup parameter, but you can't specify both.

Version Information

.NET Core App:
Supported in: 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5, 4.0, 3.5