UNPKG

@pulumi/aws

Version:

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

304 lines • 11.2 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.Job = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a Glue Job resource. * * > Glue functionality, such as monitoring and logging of jobs, is typically managed with the `defaultArguments` argument. See the [Special Parameters Used by AWS Glue](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html) topic in the Glue developer guide for additional information. * * ## Example Usage * * ### Python Glue Job * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * // IAM role for Glue jobs * const glueJobRole = new aws.iam.Role("glue_job_role", { * name: "glue-job-role", * assumeRolePolicy: JSON.stringify({ * Version: "2012-10-17", * Statement: [{ * Action: "sts:AssumeRole", * Effect: "Allow", * Principal: { * Service: "glue.amazonaws.com", * }, * }], * }), * }); * const etlJob = new aws.glue.Job("etl_job", { * name: "example-etl-job", * description: "An example Glue ETL job", * roleArn: glueJobRole.arn, * glueVersion: "5.0", * maxRetries: 0, * timeout: 2880, * numberOfWorkers: 2, * workerType: "G.1X", * connections: [example.name], * executionClass: "STANDARD", * command: { * scriptLocation: `s3://${glueScripts.bucket}/jobs/etl_job.py`, * name: "glueetl", * pythonVersion: "3", * }, * notificationProperty: { * notifyDelayAfter: 3, * }, * defaultArguments: { * "--job-language": "python", * "--continuous-log-logGroup": "/aws-glue/jobs", * "--enable-continuous-cloudwatch-log": "true", * "--enable-continuous-log-filter": "true", * "--enable-metrics": "", * "--enable-auto-scaling": "true", * }, * executionProperty: { * maxConcurrentRuns: 1, * }, * tags: { * ManagedBy: "AWS", * }, * }); * const glueEtlScript = new aws.s3.BucketObjectv2("glue_etl_script", { * bucket: glueScripts.id, * key: "jobs/etl_job.py", * source: new pulumi.asset.FileAsset("jobs/etl_job.py"), * }); * ``` * * ### Pythonshell Job * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * // IAM role for Glue jobs * const glueJobRole = new aws.iam.Role("glue_job_role", { * name: "glue-job-role", * assumeRolePolicy: JSON.stringify({ * Version: "2012-10-17", * Statement: [{ * Action: "sts:AssumeRole", * Effect: "Allow", * Principal: { * Service: "glue.amazonaws.com", * }, * }], * }), * }); * const pythonShellJob = new aws.glue.Job("python_shell_job", { * name: "example-python-shell-job", * description: "An example Python shell job", * roleArn: glueJobRole.arn, * maxCapacity: 0.0625, * maxRetries: 0, * timeout: 2880, * connections: [example.name], * command: { * scriptLocation: `s3://${glueScripts.bucket}/jobs/shell_job.py`, * name: "pythonshell", * pythonVersion: "3.9", * }, * defaultArguments: { * "--job-language": "python", * "--continuous-log-logGroup": "/aws-glue/jobs", * "--enable-continuous-cloudwatch-log": "true", * "library-set": "analytics", * }, * executionProperty: { * maxConcurrentRuns: 1, * }, * tags: { * ManagedBy: "AWS", * }, * }); * const pythonShellScript = new aws.s3.BucketObjectv2("python_shell_script", { * bucket: glueScripts.id, * key: "jobs/shell_job.py", * source: new pulumi.asset.FileAsset("jobs/shell_job.py"), * }); * ``` * * ### Ray Job * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.glue.Job("example", { * name: "example", * roleArn: exampleAwsIamRole.arn, * glueVersion: "4.0", * workerType: "Z.2X", * command: { * name: "glueray", * pythonVersion: "3.9", * runtime: "Ray2.4", * scriptLocation: `s3://${exampleAwsS3Bucket.bucket}/example.py`, * }, * }); * ``` * * ### Scala Job * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.glue.Job("example", { * name: "example", * roleArn: exampleAwsIamRole.arn, * command: { * scriptLocation: `s3://${exampleAwsS3Bucket.bucket}/example.scala`, * }, * defaultArguments: { * "--job-language": "scala", * }, * }); * ``` * * ### Streaming Job * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.glue.Job("example", { * name: "example streaming job", * roleArn: exampleAwsIamRole.arn, * command: { * name: "gluestreaming", * scriptLocation: `s3://${exampleAwsS3Bucket.bucket}/example.script`, * }, * }); * ``` * * ### Enabling CloudWatch Logs and Metrics * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.cloudwatch.LogGroup("example", { * name: "example", * retentionInDays: 14, * }); * const exampleJob = new aws.glue.Job("example", {defaultArguments: { * "--continuous-log-logGroup": example.name, * "--enable-continuous-cloudwatch-log": "true", * "--enable-continuous-log-filter": "true", * "--enable-metrics": "", * }}); * ``` * * ## Import * * Using `pulumi import`, import Glue Jobs using `name`. For example: * * ```sh * $ pulumi import aws:glue/job:Job MyJob MyJob * ``` */ class Job extends pulumi.CustomResource { /** * Get an existing Job 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 Job(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Job. 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'] === Job.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["command"] = state?.command; resourceInputs["connections"] = state?.connections; resourceInputs["defaultArguments"] = state?.defaultArguments; resourceInputs["description"] = state?.description; resourceInputs["executionClass"] = state?.executionClass; resourceInputs["executionProperty"] = state?.executionProperty; resourceInputs["glueVersion"] = state?.glueVersion; resourceInputs["jobMode"] = state?.jobMode; resourceInputs["jobRunQueuingEnabled"] = state?.jobRunQueuingEnabled; resourceInputs["maintenanceWindow"] = state?.maintenanceWindow; resourceInputs["maxCapacity"] = state?.maxCapacity; resourceInputs["maxRetries"] = state?.maxRetries; resourceInputs["name"] = state?.name; resourceInputs["nonOverridableArguments"] = state?.nonOverridableArguments; resourceInputs["notificationProperty"] = state?.notificationProperty; resourceInputs["numberOfWorkers"] = state?.numberOfWorkers; resourceInputs["region"] = state?.region; resourceInputs["roleArn"] = state?.roleArn; resourceInputs["securityConfiguration"] = state?.securityConfiguration; resourceInputs["sourceControlDetails"] = state?.sourceControlDetails; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; resourceInputs["timeout"] = state?.timeout; resourceInputs["workerType"] = state?.workerType; } else { const args = argsOrState; if (args?.command === undefined && !opts.urn) { throw new Error("Missing required property 'command'"); } if (args?.roleArn === undefined && !opts.urn) { throw new Error("Missing required property 'roleArn'"); } resourceInputs["command"] = args?.command; resourceInputs["connections"] = args?.connections; resourceInputs["defaultArguments"] = args?.defaultArguments; resourceInputs["description"] = args?.description; resourceInputs["executionClass"] = args?.executionClass; resourceInputs["executionProperty"] = args?.executionProperty; resourceInputs["glueVersion"] = args?.glueVersion; resourceInputs["jobMode"] = args?.jobMode; resourceInputs["jobRunQueuingEnabled"] = args?.jobRunQueuingEnabled; resourceInputs["maintenanceWindow"] = args?.maintenanceWindow; resourceInputs["maxCapacity"] = args?.maxCapacity; resourceInputs["maxRetries"] = args?.maxRetries; resourceInputs["name"] = args?.name; resourceInputs["nonOverridableArguments"] = args?.nonOverridableArguments; resourceInputs["notificationProperty"] = args?.notificationProperty; resourceInputs["numberOfWorkers"] = args?.numberOfWorkers; resourceInputs["region"] = args?.region; resourceInputs["roleArn"] = args?.roleArn; resourceInputs["securityConfiguration"] = args?.securityConfiguration; resourceInputs["sourceControlDetails"] = args?.sourceControlDetails; resourceInputs["tags"] = args?.tags; resourceInputs["timeout"] = args?.timeout; resourceInputs["workerType"] = args?.workerType; resourceInputs["arn"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Job.__pulumiType, name, resourceInputs, opts); } } exports.Job = Job; /** @internal */ Job.__pulumiType = 'aws:glue/job:Job'; //# sourceMappingURL=job.js.map