Class: AWSCDK::SES::CfnReceiptRule::S3ActionProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ses/cfn_receipt_rule.rb

Overview

When included in a receipt rule, this action saves the received message to an Amazon Simple Storage Service (Amazon S3) bucket and, optionally, publishes a notification to Amazon Simple Notification Service (Amazon SNS).

To enable Amazon SES to write emails to your Amazon S3 bucket, use an AWS KMS key to encrypt your emails, or publish to an Amazon SNS topic of another account, Amazon SES must have permission to access those resources. For information about granting permissions, see the Amazon SES Developer Guide .

When you save your emails to an Amazon S3 bucket, the maximum email size (including headers) is 30 MB. Emails larger than that bounces.

For information about specifying Amazon S3 actions in receipt rules, see the Amazon SES Developer Guide .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bucket_name:, iam_role_arn: nil, kms_key_arn: nil, object_key_prefix: nil, topic_arn: nil) ⇒ S3ActionProperty

Returns a new instance of S3ActionProperty.

Parameters:

  • bucket_name (String)

    The name of the Amazon S3 bucket for incoming email.

  • iam_role_arn (String, nil) (defaults to: nil)

    The ARN of the IAM role to be used by Amazon Simple Email Service while writing to the Amazon S3 bucket, optionally encrypting your mail via the provided customer managed key, and publishing to the Amazon SNS topic.

  • kms_key_arn (String, nil) (defaults to: nil)

    The customer managed key that Amazon SES should use to encrypt your emails before saving them to the Amazon S3 bucket.

  • object_key_prefix (String, nil) (defaults to: nil)

    The key prefix of the Amazon S3 bucket.

  • topic_arn (String, nil) (defaults to: nil)

    The ARN of the Amazon SNS topic to notify when the message is saved to the Amazon S3 bucket.



991
992
993
994
995
996
997
998
999
1000
1001
1002
# File 'ses/cfn_receipt_rule.rb', line 991

def initialize(bucket_name:, iam_role_arn: nil, kms_key_arn: nil, object_key_prefix: nil, topic_arn: nil)
  @bucket_name = bucket_name
  Jsii::Type.check_type(@bucket_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "bucketName")
  @iam_role_arn = iam_role_arn
  Jsii::Type.check_type(@iam_role_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "iamRoleArn") unless @iam_role_arn.nil?
  @kms_key_arn = kms_key_arn
  Jsii::Type.check_type(@kms_key_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "kmsKeyArn") unless @kms_key_arn.nil?
  @object_key_prefix = object_key_prefix
  Jsii::Type.check_type(@object_key_prefix, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "objectKeyPrefix") unless @object_key_prefix.nil?
  @topic_arn = topic_arn
  Jsii::Type.check_type(@topic_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "topicArn") unless @topic_arn.nil?
end

Instance Attribute Details

#bucket_nameString (readonly)

The name of the Amazon S3 bucket for incoming email.



1008
1009
1010
# File 'ses/cfn_receipt_rule.rb', line 1008

def bucket_name
  @bucket_name
end

#iam_role_arnString? (readonly)

The ARN of the IAM role to be used by Amazon Simple Email Service while writing to the Amazon S3 bucket, optionally encrypting your mail via the provided customer managed key, and publishing to the Amazon SNS topic.

This role should have access to the following APIs:

  • s3:PutObject , kms:Encrypt and kms:GenerateDataKey for the given Amazon S3 bucket.
  • kms:GenerateDataKey for the given AWS KMS customer managed key.
  • sns:Publish for the given Amazon SNS topic.

If an IAM role ARN is provided, the role (and only the role) is used to access all the given resources (Amazon S3 bucket, AWS KMS customer managed key and Amazon SNS topic). Therefore, setting up individual resource access permissions is not required.



1021
1022
1023
# File 'ses/cfn_receipt_rule.rb', line 1021

def iam_role_arn
  @iam_role_arn
end

#kms_key_arnString? (readonly)

The customer managed key that Amazon SES should use to encrypt your emails before saving them to the Amazon S3 bucket.

You can use the AWS managed key or a customer managed key that you created in AWS KMS as follows:

  • To use the AWS managed key, provide an ARN in the form of arn:aws:kms:REGION:ACCOUNT-ID-WITHOUT-HYPHENS:alias/aws/ses . For example, if your AWS account ID is 123456789012 and you want to use the AWS managed key in the US West (Oregon) Region, the ARN of the AWS managed key would be arn:aws:kms:us-west-2:123456789012:alias/aws/ses . If you use the AWS managed key, you don't need to perform any extra steps to give Amazon SES permission to use the key.
  • To use a customer managed key that you created in AWS KMS, provide the ARN of the customer managed key and ensure that you add a statement to your key's policy to give Amazon SES permission to use it. For more information about giving permissions, see the Amazon SES Developer Guide .

For more information about key policies, see the AWS KMS Developer Guide . If you do not specify an AWS KMS key, Amazon SES does not encrypt your emails.

Your mail is encrypted by Amazon SES using the Amazon S3 encryption client before the mail is submitted to Amazon S3 for storage. It is not encrypted using Amazon S3 server-side encryption. This means that you must use the Amazon S3 encryption client to decrypt the email after retrieving it from Amazon S3, as the service has no access to use your AWS KMS keys for decryption. This encryption client is currently available with the AWS SDK for Java and AWS SDK for Ruby only. For more information about client-side encryption using AWS KMS managed keys, see the Amazon S3 Developer Guide .



1035
1036
1037
# File 'ses/cfn_receipt_rule.rb', line 1035

def kms_key_arn
  @kms_key_arn
end

#object_key_prefixString? (readonly)

The key prefix of the Amazon S3 bucket.

The key prefix is similar to a directory name that enables you to store similar data under the same directory in a bucket.



1042
1043
1044
# File 'ses/cfn_receipt_rule.rb', line 1042

def object_key_prefix
  @object_key_prefix
end

#topic_arnString? (readonly)

The ARN of the Amazon SNS topic to notify when the message is saved to the Amazon S3 bucket.

You can find the ARN of a topic by using the ListTopics operation in Amazon SNS.

For more information about Amazon SNS topics, see the Amazon SNS Developer Guide .



1051
1052
1053
# File 'ses/cfn_receipt_rule.rb', line 1051

def topic_arn
  @topic_arn
end

Class Method Details

.jsii_propertiesObject



1053
1054
1055
1056
1057
1058
1059
1060
1061
# File 'ses/cfn_receipt_rule.rb', line 1053

def self.jsii_properties
  {
    :bucket_name => "bucketName",
    :iam_role_arn => "iamRoleArn",
    :kms_key_arn => "kmsKeyArn",
    :object_key_prefix => "objectKeyPrefix",
    :topic_arn => "topicArn",
  }
end

Instance Method Details

#to_jsiiObject



1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
# File 'ses/cfn_receipt_rule.rb', line 1063

def to_jsii
  result = {}
  result.merge!({
    "bucketName" => @bucket_name,
    "iamRoleArn" => @iam_role_arn,
    "kmsKeyArn" => @kms_key_arn,
    "objectKeyPrefix" => @object_key_prefix,
    "topicArn" => @topic_arn,
  })
  result.compact
end