UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

176 lines 7.56 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.FlowLog = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a VPC/Subnet/ENI/Transit Gateway/Transit Gateway Attachment Flow Log to capture IP traffic for a specific network * interface, subnet, or VPC. Logs are sent to a CloudWatch Log Group, a S3 Bucket, or Amazon Kinesis Data Firehose * * ## Example Usage * * ### CloudWatch Logging * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const exampleLogGroup = new aws.cloudwatch.LogGroup("example", {name: "example"}); * const assumeRole = aws.iam.getPolicyDocument({ * statements: [{ * effect: "Allow", * principals: [{ * type: "Service", * identifiers: ["vpc-flow-logs.amazonaws.com"], * }], * actions: ["sts:AssumeRole"], * }], * }); * const exampleRole = new aws.iam.Role("example", { * name: "example", * assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json), * }); * const exampleFlowLog = new aws.ec2.FlowLog("example", { * iamRoleArn: exampleRole.arn, * logDestination: exampleLogGroup.arn, * trafficType: "ALL", * vpcId: exampleAwsVpc.id, * }); * const example = aws.iam.getPolicyDocument({ * statements: [{ * effect: "Allow", * actions: [ * "logs:CreateLogGroup", * "logs:CreateLogStream", * "logs:PutLogEvents", * "logs:DescribeLogGroups", * "logs:DescribeLogStreams", * ], * resources: ["*"], * }], * }); * const exampleRolePolicy = new aws.iam.RolePolicy("example", { * name: "example", * role: exampleRole.id, * policy: example.then(example => example.json), * }); * ``` * * ### S3 Logging * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const exampleBucket = new aws.s3.Bucket("example", {bucket: "example"}); * const example = new aws.ec2.FlowLog("example", { * logDestination: exampleBucket.arn, * logDestinationType: "s3", * trafficType: "ALL", * vpcId: exampleAwsVpc.id, * }); * ``` * * ### S3 Logging in Apache Parquet format with per-hour partitions * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const exampleBucket = new aws.s3.Bucket("example", {bucket: "example"}); * const example = new aws.ec2.FlowLog("example", { * logDestination: exampleBucket.arn, * logDestinationType: "s3", * trafficType: "ALL", * vpcId: exampleAwsVpc.id, * destinationOptions: { * fileFormat: "parquet", * perHourPartition: true, * }, * }); * ``` * * ## Import * * Using `pulumi import`, import Flow Logs using the `id`. For example: * * ```sh * $ pulumi import aws:ec2/flowLog:FlowLog test_flow_log fl-1a2b3c4d * ``` */ class FlowLog extends pulumi.CustomResource { /** * Get an existing FlowLog resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new FlowLog(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of FlowLog. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === FlowLog.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state ? state.arn : undefined; resourceInputs["deliverCrossAccountRole"] = state ? state.deliverCrossAccountRole : undefined; resourceInputs["destinationOptions"] = state ? state.destinationOptions : undefined; resourceInputs["eniId"] = state ? state.eniId : undefined; resourceInputs["iamRoleArn"] = state ? state.iamRoleArn : undefined; resourceInputs["logDestination"] = state ? state.logDestination : undefined; resourceInputs["logDestinationType"] = state ? state.logDestinationType : undefined; resourceInputs["logFormat"] = state ? state.logFormat : undefined; resourceInputs["maxAggregationInterval"] = state ? state.maxAggregationInterval : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["subnetId"] = state ? state.subnetId : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["tagsAll"] = state ? state.tagsAll : undefined; resourceInputs["trafficType"] = state ? state.trafficType : undefined; resourceInputs["transitGatewayAttachmentId"] = state ? state.transitGatewayAttachmentId : undefined; resourceInputs["transitGatewayId"] = state ? state.transitGatewayId : undefined; resourceInputs["vpcId"] = state ? state.vpcId : undefined; } else { const args = argsOrState; resourceInputs["deliverCrossAccountRole"] = args ? args.deliverCrossAccountRole : undefined; resourceInputs["destinationOptions"] = args ? args.destinationOptions : undefined; resourceInputs["eniId"] = args ? args.eniId : undefined; resourceInputs["iamRoleArn"] = args ? args.iamRoleArn : undefined; resourceInputs["logDestination"] = args ? args.logDestination : undefined; resourceInputs["logDestinationType"] = args ? args.logDestinationType : undefined; resourceInputs["logFormat"] = args ? args.logFormat : undefined; resourceInputs["maxAggregationInterval"] = args ? args.maxAggregationInterval : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["subnetId"] = args ? args.subnetId : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["trafficType"] = args ? args.trafficType : undefined; resourceInputs["transitGatewayAttachmentId"] = args ? args.transitGatewayAttachmentId : undefined; resourceInputs["transitGatewayId"] = args ? args.transitGatewayId : undefined; resourceInputs["vpcId"] = args ? args.vpcId : undefined; resourceInputs["arn"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(FlowLog.__pulumiType, name, resourceInputs, opts); } } exports.FlowLog = FlowLog; /** @internal */ FlowLog.__pulumiType = 'aws:ec2/flowLog:FlowLog'; //# sourceMappingURL=flowLog.js.map