AWS Macie S3 Bucket Association

This page shows how to write Terraform and CloudFormation for Macie S3 Bucket Association and write them securely.

aws_macie_s3_bucket_association (Terraform)

The S3 Bucket Association in Macie can be configured in Terraform with the resource name aws_macie_s3_bucket_association. The following sections describe 4 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L10
resource "aws_macie_s3_bucket_association" "example" {
  bucket_name = "tf-macie-example"
  prefix      = "data"

  classification_type {
    one_time = "FULL"
main.tf#L5
resource "aws_macie_s3_bucket_association" "example" {
  bucket_name = var.bucket_name
}


main.tf#L7
resource "aws_macie_s3_bucket_association" "this" {
  bucket_name       = var.bucket_name
  member_account_id = var.member_account_id
  prefix            = var.prefix

  dynamic "classification_type" {
macie_s3_bucket_association.tf#L4
resource "aws_macie_s3_bucket_association" "macie_s3_bucket_association" {
  count = var.enable_macie_s3_bucket_association ? 1 : 0

  bucket_name = var.macie_s3_bucket_association_bucket_name

  member_account_id = var.macie_s3_bucket_association_member_account_id != "" && !var.enable_macie_member_account_association ? var.macie_s3_bucket_association_member_account_id : element(concat(aws_macie_member_account_association.macie_member_account_association.*.id, [""]), 0)

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

NOTE: This resource interacts with Amazon Macie Classic. Macie Classic cannot be activated in new accounts. See the FAQ for more details. Associates an S3 resource with Amazon Macie for monitoring and data classification. NOTE: Before using Amazon Macie for the first time it must be enabled manually. Instructions are here.

AWS::Macie::FindingsFilter (CloudFormation)

The FindingsFilter in Macie can be configured in CloudFormation with the resource name AWS::Macie::FindingsFilter. The following sections describe 8 examples of how to use the resource and its parameters.

Example Usage from GitHub

product.template-us-west-1.yaml#L9
    Type: AWS::Macie::FindingsFilter
    Description: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-macie-findingsfilter.html
    Properties:
      Name: !Ref 'Name'
      FindingCriteria: {}
Outputs:
product.template-eu-north-1.yaml#L9
    Type: AWS::Macie::FindingsFilter
    Description: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-macie-findingsfilter.html
    Properties:
      Name: !Ref 'Name'
      FindingCriteria: {}
Outputs:
product.template-ap-northeast-2.yaml#L9
    Type: AWS::Macie::FindingsFilter
    Description: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-macie-findingsfilter.html
    Properties:
      Name: !Ref 'Name'
      FindingCriteria: {}
Outputs:
product.template-sa-east-1.yaml#L9
    Type: AWS::Macie::FindingsFilter
    Description: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-macie-findingsfilter.html
    Properties:
      Name: !Ref 'Name'
      FindingCriteria: {}
Outputs:
product.template-us-east-1.yaml#L9
    Type: AWS::Macie::FindingsFilter
    Description: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-macie-findingsfilter.html
    Properties:
      Name: !Ref 'Name'
      FindingCriteria: {}
Outputs:
MacieFindingsFilterSpecification.json#L3
    "AWS::Macie::FindingsFilter.Criterion": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-macie-findingsfilter-criterion.html"
    },
    "AWS::Macie::FindingsFilter.FindingCriteria": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-macie-findingsfilter-findingcriteria.html",
      "Properties": {
awsResouceIconMatches.json#L2214
        "resourceType": "AWS::Macie::FindingsFilter",
        "filePath": null
      },
      {
        "resourceType": "AWS::Macie::CustomDataIdentifier",
        "filePath": null
template.json#L1687
    "AWS::Macie::FindingsFilter": {
      "Type": "AWS::Macie::FindingsFilter",
      "Properties": {}
    },
    "AWS::EC2::LaunchTemplate": {
      "Type": "AWS::EC2::LaunchTemplate",

Parameters

Explanation in CloudFormation Registry

The AWS::Macie::FindingsFilter resource represents an individual findings filter that you create and save to view, analyze, and manage findings. A findings filter is a set of criteria that specifies which findings to include in the results of a query for findings. A findings filter can also perform specific actions on findings that meet the filter's criteria.

A Session must exist for the account before you can create a FindingsFilter. Use a DependsOn attribute to ensure that the Session is created before the other resources. For example, "DependsOn: Session".

Frequently asked questions

What is AWS Macie S3 Bucket Association?

AWS Macie S3 Bucket Association is a resource for Macie of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Macie S3 Bucket Association?

For Terraform, the tesera/terraform-modules, gauravgitdir/Jack and niveklabs/aws source code examples are useful. See the Terraform Example section for further details.

For CloudFormation, the awslabs/aws-service-catalog-products, awslabs/aws-service-catalog-products and awslabs/aws-service-catalog-products source code examples are useful. See the CloudFormation Example section for further details.