AWS Classic

v4.30.0 published on Tuesday, Nov 30, 2021 by Pulumi

RealtimeLogConfig

Provides a CloudFront real-time log configuration resource.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleRole = new Aws.Iam.Role("exampleRole", new Aws.Iam.RoleArgs
        {
            AssumeRolePolicy = @"{
  ""Version"": ""2012-10-17"",
  ""Statement"": [
    {
      ""Action"": ""sts:AssumeRole"",
      ""Principal"": {
        ""Service"": ""cloudfront.amazonaws.com""
      },
      ""Effect"": ""Allow""
    }
  ]
}
",
        });
        var exampleRolePolicy = new Aws.Iam.RolePolicy("exampleRolePolicy", new Aws.Iam.RolePolicyArgs
        {
            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 Aws.CloudFront.RealtimeLogConfigArgs
        {
            SamplingRate = 75,
            Fields = 
            {
                "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 = 
            {
                exampleRolePolicy,
            },
        });
    }

}
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/cloudfront"
	"github.com/pulumi/pulumi-aws/sdk/v4/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("%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", "  \"Version\": \"2012-10-17\",\n", "  \"Statement\": [\n", "    {\n", "      \"Action\": \"sts:AssumeRole\",\n", "      \"Principal\": {\n", "        \"Service\": \"cloudfront.amazonaws.com\"\n", "      },\n", "      \"Effect\": \"Allow\"\n", "    }\n", "  ]\n", "}\n")),
		})
		if err != nil {
			return err
		}
		exampleRolePolicy, err := iam.NewRolePolicy(ctx, "exampleRolePolicy", &iam.RolePolicyArgs{
			Role:   exampleRole.ID(),
			Policy: pulumi.Any(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", "  \"Version\": \"2012-10-17\",\n", "  \"Statement\": [\n", "    {\n", "        \"Effect\": \"Allow\",\n", "        \"Action\": [\n", "          \"kinesis:DescribeStreamSummary\",\n", "          \"kinesis:DescribeStream\",\n", "          \"kinesis:PutRecord\",\n", "          \"kinesis:PutRecords\"\n", "        ],\n", "        \"Resource\": \"", aws_kinesis_stream.Example.Arn, "\"\n", "    }\n", "  ]\n", "}\n")),
		})
		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
	})
}
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],
});

Create a 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)
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.

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 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.

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 str
The ARN (Amazon Resource Name) of the CloudFront real-time log configuration.
id str
The provider-assigned unique ID for this managed resource.

Look up an 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)
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.

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 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.

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.
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.

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.
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.

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
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.