aws logo
AWS Classic v5.29.0, Feb 1 23

aws.cloudfront.RealtimeLogConfig

Provides a CloudFront real-time log configuration resource.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var exampleRole = new Aws.Iam.Role("exampleRole", new()
    {
        AssumeRolePolicy = @"{
  ""Version"": ""2012-10-17"",
  ""Statement"": [
    {
      ""Action"": ""sts:AssumeRole"",
      ""Principal"": {
        ""Service"": ""cloudfront.amazonaws.com""
      },
      ""Effect"": ""Allow""
    }
  ]
}
",
    });

    var exampleRolePolicy = new Aws.Iam.RolePolicy("exampleRolePolicy", new()
    {
        Role = exampleRole.Id,
        Policy = @$"{{
  ""Version"": ""2012-10-17"",
  ""Statement"": [
    {{
        ""Effect"": ""Allow"",
        ""Action"": [
          ""kinesis:DescribeStreamSummary"",
          ""kinesis:DescribeStream"",
          ""kinesis:PutRecord"",
          ""kinesis:PutRecords""
        ],
        ""Resource"": ""{aws_kinesis_stream.Example.Arn}""
    }}
  ]
}}
",
    });

    var exampleRealtimeLogConfig = new Aws.CloudFront.RealtimeLogConfig("exampleRealtimeLogConfig", new()
    {
        SamplingRate = 75,
        Fields = new[]
        {
            "timestamp",
            "c-ip",
        },
        Endpoint = new Aws.CloudFront.Inputs.RealtimeLogConfigEndpointArgs
        {
            StreamType = "Kinesis",
            KinesisStreamConfig = new Aws.CloudFront.Inputs.RealtimeLogConfigEndpointKinesisStreamConfigArgs
            {
                RoleArn = exampleRole.Arn,
                StreamArn = aws_kinesis_stream.Example.Arn,
            },
        },
    }, new CustomResourceOptions
    {
        DependsOn = new[]
        {
            exampleRolePolicy,
        },
    });

});
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/cloudfront"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/iam"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleRole, err := iam.NewRole(ctx, "exampleRole", &iam.RoleArgs{
			AssumeRolePolicy: pulumi.Any(fmt.Sprintf(`{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": "cloudfront.amazonaws.com"
      },
      "Effect": "Allow"
    }
  ]
}
`)),
		})
		if err != nil {
			return err
		}
		exampleRolePolicy, err := iam.NewRolePolicy(ctx, "exampleRolePolicy", &iam.RolePolicyArgs{
			Role: exampleRole.ID(),
			Policy: pulumi.Any(fmt.Sprintf(`{
  "Version": "2012-10-17",
  "Statement": [
    {
        "Effect": "Allow",
        "Action": [
          "kinesis:DescribeStreamSummary",
          "kinesis:DescribeStream",
          "kinesis:PutRecord",
          "kinesis:PutRecords"
        ],
        "Resource": "%v"
    }
  ]
}
`, aws_kinesis_stream.Example.Arn)),
		})
		if err != nil {
			return err
		}
		_, err = cloudfront.NewRealtimeLogConfig(ctx, "exampleRealtimeLogConfig", &cloudfront.RealtimeLogConfigArgs{
			SamplingRate: pulumi.Int(75),
			Fields: pulumi.StringArray{
				pulumi.String("timestamp"),
				pulumi.String("c-ip"),
			},
			Endpoint: &cloudfront.RealtimeLogConfigEndpointArgs{
				StreamType: pulumi.String("Kinesis"),
				KinesisStreamConfig: &cloudfront.RealtimeLogConfigEndpointKinesisStreamConfigArgs{
					RoleArn:   exampleRole.Arn,
					StreamArn: pulumi.Any(aws_kinesis_stream.Example.Arn),
				},
			},
		}, pulumi.DependsOn([]pulumi.Resource{
			exampleRolePolicy,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.iam.RolePolicy;
import com.pulumi.aws.iam.RolePolicyArgs;
import com.pulumi.aws.cloudfront.RealtimeLogConfig;
import com.pulumi.aws.cloudfront.RealtimeLogConfigArgs;
import com.pulumi.aws.cloudfront.inputs.RealtimeLogConfigEndpointArgs;
import com.pulumi.aws.cloudfront.inputs.RealtimeLogConfigEndpointKinesisStreamConfigArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var exampleRole = new Role("exampleRole", RoleArgs.builder()        
            .assumeRolePolicy("""
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": "cloudfront.amazonaws.com"
      },
      "Effect": "Allow"
    }
  ]
}
            """)
            .build());

        var exampleRolePolicy = new RolePolicy("exampleRolePolicy", RolePolicyArgs.builder()        
            .role(exampleRole.id())
            .policy("""
{
  "Version": "2012-10-17",
  "Statement": [
    {
        "Effect": "Allow",
        "Action": [
          "kinesis:DescribeStreamSummary",
          "kinesis:DescribeStream",
          "kinesis:PutRecord",
          "kinesis:PutRecords"
        ],
        "Resource": "%s"
    }
  ]
}
", aws_kinesis_stream.example().arn()))
            .build());

        var exampleRealtimeLogConfig = new RealtimeLogConfig("exampleRealtimeLogConfig", RealtimeLogConfigArgs.builder()        
            .samplingRate(75)
            .fields(            
                "timestamp",
                "c-ip")
            .endpoint(RealtimeLogConfigEndpointArgs.builder()
                .streamType("Kinesis")
                .kinesisStreamConfig(RealtimeLogConfigEndpointKinesisStreamConfigArgs.builder()
                    .roleArn(exampleRole.arn())
                    .streamArn(aws_kinesis_stream.example().arn())
                    .build())
                .build())
            .build(), CustomResourceOptions.builder()
                .dependsOn(exampleRolePolicy)
                .build());

    }
}
import pulumi
import pulumi_aws as aws

example_role = aws.iam.Role("exampleRole", assume_role_policy="""{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": "cloudfront.amazonaws.com"
      },
      "Effect": "Allow"
    }
  ]
}
""")
example_role_policy = aws.iam.RolePolicy("exampleRolePolicy",
    role=example_role.id,
    policy=f"""{{
  "Version": "2012-10-17",
  "Statement": [
    {{
        "Effect": "Allow",
        "Action": [
          "kinesis:DescribeStreamSummary",
          "kinesis:DescribeStream",
          "kinesis:PutRecord",
          "kinesis:PutRecords"
        ],
        "Resource": "{aws_kinesis_stream["example"]["arn"]}"
    }}
  ]
}}
""")
example_realtime_log_config = aws.cloudfront.RealtimeLogConfig("exampleRealtimeLogConfig",
    sampling_rate=75,
    fields=[
        "timestamp",
        "c-ip",
    ],
    endpoint=aws.cloudfront.RealtimeLogConfigEndpointArgs(
        stream_type="Kinesis",
        kinesis_stream_config=aws.cloudfront.RealtimeLogConfigEndpointKinesisStreamConfigArgs(
            role_arn=example_role.arn,
            stream_arn=aws_kinesis_stream["example"]["arn"],
        ),
    ),
    opts=pulumi.ResourceOptions(depends_on=[example_role_policy]))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const exampleRole = new aws.iam.Role("exampleRole", {assumeRolePolicy: `{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": "cloudfront.amazonaws.com"
      },
      "Effect": "Allow"
    }
  ]
}
`});
const exampleRolePolicy = new aws.iam.RolePolicy("exampleRolePolicy", {
    role: exampleRole.id,
    policy: `{
  "Version": "2012-10-17",
  "Statement": [
    {
        "Effect": "Allow",
        "Action": [
          "kinesis:DescribeStreamSummary",
          "kinesis:DescribeStream",
          "kinesis:PutRecord",
          "kinesis:PutRecords"
        ],
        "Resource": "${aws_kinesis_stream.example.arn}"
    }
  ]
}
`,
});
const exampleRealtimeLogConfig = new aws.cloudfront.RealtimeLogConfig("exampleRealtimeLogConfig", {
    samplingRate: 75,
    fields: [
        "timestamp",
        "c-ip",
    ],
    endpoint: {
        streamType: "Kinesis",
        kinesisStreamConfig: {
            roleArn: exampleRole.arn,
            streamArn: aws_kinesis_stream.example.arn,
        },
    },
}, {
    dependsOn: [exampleRolePolicy],
});
resources:
  exampleRole:
    type: aws:iam:Role
    properties:
      assumeRolePolicy: |
        {
          "Version": "2012-10-17",
          "Statement": [
            {
              "Action": "sts:AssumeRole",
              "Principal": {
                "Service": "cloudfront.amazonaws.com"
              },
              "Effect": "Allow"
            }
          ]
        }        
  exampleRolePolicy:
    type: aws:iam:RolePolicy
    properties:
      role: ${exampleRole.id}
      policy: |
        {
          "Version": "2012-10-17",
          "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                  "kinesis:DescribeStreamSummary",
                  "kinesis:DescribeStream",
                  "kinesis:PutRecord",
                  "kinesis:PutRecords"
                ],
                "Resource": "${aws_kinesis_stream.example.arn}"
            }
          ]
        }        
  exampleRealtimeLogConfig:
    type: aws:cloudfront:RealtimeLogConfig
    properties:
      samplingRate: 75
      fields:
        - timestamp
        - c-ip
      endpoint:
        streamType: Kinesis
        kinesisStreamConfig:
          roleArn: ${exampleRole.arn}
          streamArn: ${aws_kinesis_stream.example.arn}
    options:
      dependson:
        - ${exampleRolePolicy}

Create RealtimeLogConfig Resource

new RealtimeLogConfig(name: string, args: RealtimeLogConfigArgs, opts?: CustomResourceOptions);
@overload
def RealtimeLogConfig(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      endpoint: Optional[RealtimeLogConfigEndpointArgs] = None,
                      fields: Optional[Sequence[str]] = None,
                      name: Optional[str] = None,
                      sampling_rate: Optional[int] = None)
@overload
def RealtimeLogConfig(resource_name: str,
                      args: RealtimeLogConfigArgs,
                      opts: Optional[ResourceOptions] = None)
func NewRealtimeLogConfig(ctx *Context, name string, args RealtimeLogConfigArgs, opts ...ResourceOption) (*RealtimeLogConfig, error)
public RealtimeLogConfig(string name, RealtimeLogConfigArgs args, CustomResourceOptions? opts = null)
public RealtimeLogConfig(String name, RealtimeLogConfigArgs args)
public RealtimeLogConfig(String name, RealtimeLogConfigArgs args, CustomResourceOptions options)
type: aws:cloudfront:RealtimeLogConfig
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args RealtimeLogConfigArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args RealtimeLogConfigArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args RealtimeLogConfigArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args RealtimeLogConfigArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args RealtimeLogConfigArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

RealtimeLogConfig Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The RealtimeLogConfig resource accepts the following input properties:

Endpoint RealtimeLogConfigEndpointArgs

The Amazon Kinesis data streams where real-time log data is sent.

Fields List<string>

The fields that are included in each real-time log record. See the AWS documentation for supported values.

SamplingRate int

The sampling rate for this real-time log configuration. The sampling rate determines the percentage of viewer requests that are represented in the real-time log data. An integer between 1 and 100, inclusive.

Name string

The unique name to identify this real-time log configuration.

Endpoint RealtimeLogConfigEndpointArgs

The Amazon Kinesis data streams where real-time log data is sent.

Fields []string

The fields that are included in each real-time log record. See the AWS documentation for supported values.

SamplingRate int

The sampling rate for this real-time log configuration. The sampling rate determines the percentage of viewer requests that are represented in the real-time log data. An integer between 1 and 100, inclusive.

Name string

The unique name to identify this real-time log configuration.

endpoint RealtimeLogConfigEndpointArgs

The Amazon Kinesis data streams where real-time log data is sent.

fields List<String>

The fields that are included in each real-time log record. See the AWS documentation for supported values.

samplingRate Integer

The sampling rate for this real-time log configuration. The sampling rate determines the percentage of viewer requests that are represented in the real-time log data. An integer between 1 and 100, inclusive.

name String

The unique name to identify this real-time log configuration.

endpoint RealtimeLogConfigEndpointArgs

The Amazon Kinesis data streams where real-time log data is sent.

fields string[]

The fields that are included in each real-time log record. See the AWS documentation for supported values.

samplingRate number

The sampling rate for this real-time log configuration. The sampling rate determines the percentage of viewer requests that are represented in the real-time log data. An integer between 1 and 100, inclusive.

name string

The unique name to identify this real-time log configuration.

endpoint RealtimeLogConfigEndpointArgs

The Amazon Kinesis data streams where real-time log data is sent.

fields Sequence[str]

The fields that are included in each real-time log record. See the AWS documentation for supported values.

sampling_rate int

The sampling rate for this real-time log configuration. The sampling rate determines the percentage of viewer requests that are represented in the real-time log data. An integer between 1 and 100, inclusive.

name str

The unique name to identify this real-time log configuration.

endpoint Property Map

The Amazon Kinesis data streams where real-time log data is sent.

fields List<String>

The fields that are included in each real-time log record. See the AWS documentation for supported values.

samplingRate Number

The sampling rate for this real-time log configuration. The sampling rate determines the percentage of viewer requests that are represented in the real-time log data. An integer between 1 and 100, inclusive.

name String

The unique name to identify this real-time log configuration.

Outputs

All input properties are implicitly available as output properties. Additionally, the RealtimeLogConfig resource produces the following output properties:

Arn string

The ARN (Amazon Resource Name) of the CloudFront real-time log configuration.

Id string

The provider-assigned unique ID for this managed resource.

Arn string

The ARN (Amazon Resource Name) of the CloudFront real-time log configuration.

Id string

The provider-assigned unique ID for this managed resource.

arn String

The ARN (Amazon Resource Name) of the CloudFront real-time log configuration.

id String

The provider-assigned unique ID for this managed resource.

arn string

The ARN (Amazon Resource Name) of the CloudFront real-time log configuration.

id string

The provider-assigned unique ID for this managed resource.

arn str

The ARN (Amazon Resource Name) of the CloudFront real-time log configuration.

id str

The provider-assigned unique ID for this managed resource.

arn String

The ARN (Amazon Resource Name) of the CloudFront real-time log configuration.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing RealtimeLogConfig Resource

Get an existing RealtimeLogConfig resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: RealtimeLogConfigState, opts?: CustomResourceOptions): RealtimeLogConfig
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        arn: Optional[str] = None,
        endpoint: Optional[RealtimeLogConfigEndpointArgs] = None,
        fields: Optional[Sequence[str]] = None,
        name: Optional[str] = None,
        sampling_rate: Optional[int] = None) -> RealtimeLogConfig
func GetRealtimeLogConfig(ctx *Context, name string, id IDInput, state *RealtimeLogConfigState, opts ...ResourceOption) (*RealtimeLogConfig, error)
public static RealtimeLogConfig Get(string name, Input<string> id, RealtimeLogConfigState? state, CustomResourceOptions? opts = null)
public static RealtimeLogConfig get(String name, Output<String> id, RealtimeLogConfigState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Arn string

The ARN (Amazon Resource Name) of the CloudFront real-time log configuration.

Endpoint RealtimeLogConfigEndpointArgs

The Amazon Kinesis data streams where real-time log data is sent.

Fields List<string>

The fields that are included in each real-time log record. See the AWS documentation for supported values.

Name string

The unique name to identify this real-time log configuration.

SamplingRate int

The sampling rate for this real-time log configuration. The sampling rate determines the percentage of viewer requests that are represented in the real-time log data. An integer between 1 and 100, inclusive.

Arn string

The ARN (Amazon Resource Name) of the CloudFront real-time log configuration.

Endpoint RealtimeLogConfigEndpointArgs

The Amazon Kinesis data streams where real-time log data is sent.

Fields []string

The fields that are included in each real-time log record. See the AWS documentation for supported values.

Name string

The unique name to identify this real-time log configuration.

SamplingRate int

The sampling rate for this real-time log configuration. The sampling rate determines the percentage of viewer requests that are represented in the real-time log data. An integer between 1 and 100, inclusive.

arn String

The ARN (Amazon Resource Name) of the CloudFront real-time log configuration.

endpoint RealtimeLogConfigEndpointArgs

The Amazon Kinesis data streams where real-time log data is sent.

fields List<String>

The fields that are included in each real-time log record. See the AWS documentation for supported values.

name String

The unique name to identify this real-time log configuration.

samplingRate Integer

The sampling rate for this real-time log configuration. The sampling rate determines the percentage of viewer requests that are represented in the real-time log data. An integer between 1 and 100, inclusive.

arn string

The ARN (Amazon Resource Name) of the CloudFront real-time log configuration.

endpoint RealtimeLogConfigEndpointArgs

The Amazon Kinesis data streams where real-time log data is sent.

fields string[]

The fields that are included in each real-time log record. See the AWS documentation for supported values.

name string

The unique name to identify this real-time log configuration.

samplingRate number

The sampling rate for this real-time log configuration. The sampling rate determines the percentage of viewer requests that are represented in the real-time log data. An integer between 1 and 100, inclusive.

arn str

The ARN (Amazon Resource Name) of the CloudFront real-time log configuration.

endpoint RealtimeLogConfigEndpointArgs

The Amazon Kinesis data streams where real-time log data is sent.

fields Sequence[str]

The fields that are included in each real-time log record. See the AWS documentation for supported values.

name str

The unique name to identify this real-time log configuration.

sampling_rate int

The sampling rate for this real-time log configuration. The sampling rate determines the percentage of viewer requests that are represented in the real-time log data. An integer between 1 and 100, inclusive.

arn String

The ARN (Amazon Resource Name) of the CloudFront real-time log configuration.

endpoint Property Map

The Amazon Kinesis data streams where real-time log data is sent.

fields List<String>

The fields that are included in each real-time log record. See the AWS documentation for supported values.

name String

The unique name to identify this real-time log configuration.

samplingRate Number

The sampling rate for this real-time log configuration. The sampling rate determines the percentage of viewer requests that are represented in the real-time log data. An integer between 1 and 100, inclusive.

Supporting Types

RealtimeLogConfigEndpoint

KinesisStreamConfig RealtimeLogConfigEndpointKinesisStreamConfig

The Amazon Kinesis data stream configuration.

StreamType string

The type of data stream where real-time log data is sent. The only valid value is Kinesis.

KinesisStreamConfig RealtimeLogConfigEndpointKinesisStreamConfig

The Amazon Kinesis data stream configuration.

StreamType string

The type of data stream where real-time log data is sent. The only valid value is Kinesis.

kinesisStreamConfig RealtimeLogConfigEndpointKinesisStreamConfig

The Amazon Kinesis data stream configuration.

streamType String

The type of data stream where real-time log data is sent. The only valid value is Kinesis.

kinesisStreamConfig RealtimeLogConfigEndpointKinesisStreamConfig

The Amazon Kinesis data stream configuration.

streamType string

The type of data stream where real-time log data is sent. The only valid value is Kinesis.

kinesis_stream_config RealtimeLogConfigEndpointKinesisStreamConfig

The Amazon Kinesis data stream configuration.

stream_type str

The type of data stream where real-time log data is sent. The only valid value is Kinesis.

kinesisStreamConfig Property Map

The Amazon Kinesis data stream configuration.

streamType String

The type of data stream where real-time log data is sent. The only valid value is Kinesis.

RealtimeLogConfigEndpointKinesisStreamConfig

RoleArn string

The ARN of an IAM role that CloudFront can use to send real-time log data to the Kinesis data stream. See the AWS documentation for more information.

StreamArn string

The ARN of the Kinesis data stream.

RoleArn string

The ARN of an IAM role that CloudFront can use to send real-time log data to the Kinesis data stream. See the AWS documentation for more information.

StreamArn string

The ARN of the Kinesis data stream.

roleArn String

The ARN of an IAM role that CloudFront can use to send real-time log data to the Kinesis data stream. See the AWS documentation for more information.

streamArn String

The ARN of the Kinesis data stream.

roleArn string

The ARN of an IAM role that CloudFront can use to send real-time log data to the Kinesis data stream. See the AWS documentation for more information.

streamArn string

The ARN of the Kinesis data stream.

role_arn str

The ARN of an IAM role that CloudFront can use to send real-time log data to the Kinesis data stream. See the AWS documentation for more information.

stream_arn str

The ARN of the Kinesis data stream.

roleArn String

The ARN of an IAM role that CloudFront can use to send real-time log data to the Kinesis data stream. See the AWS documentation for more information.

streamArn String

The ARN of the Kinesis data stream.

Import

CloudFront real-time log configurations can be imported using the ARN, e.g.,

 $ pulumi import aws:cloudfront/realtimeLogConfig:RealtimeLogConfig example arn:aws:cloudfront::111122223333:realtime-log-config/ExampleNameForRealtimeLogConfig

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.