aws.cloudwatch.EventTarget
Explore with Pulumi AI
Provides an EventBridge Target resource.
Note: EventBridge was formerly known as CloudWatch Events. The functionality is identical.
Example Usage
Kinesis Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const console = new aws.cloudwatch.EventRule("console", {
name: "capture-ec2-scaling-events",
description: "Capture all EC2 scaling events",
eventPattern: JSON.stringify({
source: ["aws.autoscaling"],
"detail-type": [
"EC2 Instance Launch Successful",
"EC2 Instance Terminate Successful",
"EC2 Instance Launch Unsuccessful",
"EC2 Instance Terminate Unsuccessful",
],
}),
});
const testStream = new aws.kinesis.Stream("test_stream", {
name: "kinesis-test",
shardCount: 1,
});
const yada = new aws.cloudwatch.EventTarget("yada", {
targetId: "Yada",
rule: console.name,
arn: testStream.arn,
runCommandTargets: [
{
key: "tag:Name",
values: ["FooBar"],
},
{
key: "InstanceIds",
values: ["i-162058cd308bffec2"],
},
],
});
import pulumi
import json
import pulumi_aws as aws
console = aws.cloudwatch.EventRule("console",
name="capture-ec2-scaling-events",
description="Capture all EC2 scaling events",
event_pattern=json.dumps({
"source": ["aws.autoscaling"],
"detail-type": [
"EC2 Instance Launch Successful",
"EC2 Instance Terminate Successful",
"EC2 Instance Launch Unsuccessful",
"EC2 Instance Terminate Unsuccessful",
],
}))
test_stream = aws.kinesis.Stream("test_stream",
name="kinesis-test",
shard_count=1)
yada = aws.cloudwatch.EventTarget("yada",
target_id="Yada",
rule=console.name,
arn=test_stream.arn,
run_command_targets=[
{
"key": "tag:Name",
"values": ["FooBar"],
},
{
"key": "InstanceIds",
"values": ["i-162058cd308bffec2"],
},
])
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kinesis"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
tmpJSON0, err := json.Marshal(map[string]interface{}{
"source": []string{
"aws.autoscaling",
},
"detail-type": []string{
"EC2 Instance Launch Successful",
"EC2 Instance Terminate Successful",
"EC2 Instance Launch Unsuccessful",
"EC2 Instance Terminate Unsuccessful",
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
console, err := cloudwatch.NewEventRule(ctx, "console", &cloudwatch.EventRuleArgs{
Name: pulumi.String("capture-ec2-scaling-events"),
Description: pulumi.String("Capture all EC2 scaling events"),
EventPattern: pulumi.String(json0),
})
if err != nil {
return err
}
testStream, err := kinesis.NewStream(ctx, "test_stream", &kinesis.StreamArgs{
Name: pulumi.String("kinesis-test"),
ShardCount: pulumi.Int(1),
})
if err != nil {
return err
}
_, err = cloudwatch.NewEventTarget(ctx, "yada", &cloudwatch.EventTargetArgs{
TargetId: pulumi.String("Yada"),
Rule: console.Name,
Arn: testStream.Arn,
RunCommandTargets: cloudwatch.EventTargetRunCommandTargetArray{
&cloudwatch.EventTargetRunCommandTargetArgs{
Key: pulumi.String("tag:Name"),
Values: pulumi.StringArray{
pulumi.String("FooBar"),
},
},
&cloudwatch.EventTargetRunCommandTargetArgs{
Key: pulumi.String("InstanceIds"),
Values: pulumi.StringArray{
pulumi.String("i-162058cd308bffec2"),
},
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var console = new Aws.CloudWatch.EventRule("console", new()
{
Name = "capture-ec2-scaling-events",
Description = "Capture all EC2 scaling events",
EventPattern = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["source"] = new[]
{
"aws.autoscaling",
},
["detail-type"] = new[]
{
"EC2 Instance Launch Successful",
"EC2 Instance Terminate Successful",
"EC2 Instance Launch Unsuccessful",
"EC2 Instance Terminate Unsuccessful",
},
}),
});
var testStream = new Aws.Kinesis.Stream("test_stream", new()
{
Name = "kinesis-test",
ShardCount = 1,
});
var yada = new Aws.CloudWatch.EventTarget("yada", new()
{
TargetId = "Yada",
Rule = console.Name,
Arn = testStream.Arn,
RunCommandTargets = new[]
{
new Aws.CloudWatch.Inputs.EventTargetRunCommandTargetArgs
{
Key = "tag:Name",
Values = new[]
{
"FooBar",
},
},
new Aws.CloudWatch.Inputs.EventTargetRunCommandTargetArgs
{
Key = "InstanceIds",
Values = new[]
{
"i-162058cd308bffec2",
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudwatch.EventRule;
import com.pulumi.aws.cloudwatch.EventRuleArgs;
import com.pulumi.aws.kinesis.Stream;
import com.pulumi.aws.kinesis.StreamArgs;
import com.pulumi.aws.cloudwatch.EventTarget;
import com.pulumi.aws.cloudwatch.EventTargetArgs;
import com.pulumi.aws.cloudwatch.inputs.EventTargetRunCommandTargetArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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 console = new EventRule("console", EventRuleArgs.builder()
.name("capture-ec2-scaling-events")
.description("Capture all EC2 scaling events")
.eventPattern(serializeJson(
jsonObject(
jsonProperty("source", jsonArray("aws.autoscaling")),
jsonProperty("detail-type", jsonArray(
"EC2 Instance Launch Successful",
"EC2 Instance Terminate Successful",
"EC2 Instance Launch Unsuccessful",
"EC2 Instance Terminate Unsuccessful"
))
)))
.build());
var testStream = new Stream("testStream", StreamArgs.builder()
.name("kinesis-test")
.shardCount(1)
.build());
var yada = new EventTarget("yada", EventTargetArgs.builder()
.targetId("Yada")
.rule(console.name())
.arn(testStream.arn())
.runCommandTargets(
EventTargetRunCommandTargetArgs.builder()
.key("tag:Name")
.values("FooBar")
.build(),
EventTargetRunCommandTargetArgs.builder()
.key("InstanceIds")
.values("i-162058cd308bffec2")
.build())
.build());
}
}
resources:
yada:
type: aws:cloudwatch:EventTarget
properties:
targetId: Yada
rule: ${console.name}
arn: ${testStream.arn}
runCommandTargets:
- key: tag:Name
values:
- FooBar
- key: InstanceIds
values:
- i-162058cd308bffec2
console:
type: aws:cloudwatch:EventRule
properties:
name: capture-ec2-scaling-events
description: Capture all EC2 scaling events
eventPattern:
fn::toJSON:
source:
- aws.autoscaling
detail-type:
- EC2 Instance Launch Successful
- EC2 Instance Terminate Successful
- EC2 Instance Launch Unsuccessful
- EC2 Instance Terminate Unsuccessful
testStream:
type: aws:kinesis:Stream
name: test_stream
properties:
name: kinesis-test
shardCount: 1
SSM Document Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const ssmLifecycleTrust = aws.iam.getPolicyDocument({
statements: [{
actions: ["sts:AssumeRole"],
principals: [{
type: "Service",
identifiers: ["events.amazonaws.com"],
}],
}],
});
const stopInstance = new aws.ssm.Document("stop_instance", {
name: "stop_instance",
documentType: "Command",
content: JSON.stringify({
schemaVersion: "1.2",
description: "Stop an instance",
parameters: {},
runtimeConfig: {
"aws:runShellScript": {
properties: [{
id: "0.aws:runShellScript",
runCommand: ["halt"],
}],
},
},
}),
});
const ssmLifecycle = aws.iam.getPolicyDocumentOutput({
statements: [
{
effect: "Allow",
actions: ["ssm:SendCommand"],
resources: ["arn:aws:ec2:eu-west-1:1234567890:instance/*"],
conditions: [{
test: "StringEquals",
variable: "ec2:ResourceTag/Terminate",
values: ["*"],
}],
},
{
effect: "Allow",
actions: ["ssm:SendCommand"],
resources: [stopInstance.arn],
},
],
});
const ssmLifecycleRole = new aws.iam.Role("ssm_lifecycle", {
name: "SSMLifecycle",
assumeRolePolicy: ssmLifecycleTrust.then(ssmLifecycleTrust => ssmLifecycleTrust.json),
});
const ssmLifecyclePolicy = new aws.iam.Policy("ssm_lifecycle", {
name: "SSMLifecycle",
policy: ssmLifecycle.apply(ssmLifecycle => ssmLifecycle.json),
});
const ssmLifecycleRolePolicyAttachment = new aws.iam.RolePolicyAttachment("ssm_lifecycle", {
policyArn: ssmLifecyclePolicy.arn,
role: ssmLifecycleRole.name,
});
const stopInstances = new aws.cloudwatch.EventRule("stop_instances", {
name: "StopInstance",
description: "Stop instances nightly",
scheduleExpression: "cron(0 0 * * ? *)",
});
const stopInstancesEventTarget = new aws.cloudwatch.EventTarget("stop_instances", {
targetId: "StopInstance",
arn: stopInstance.arn,
rule: stopInstances.name,
roleArn: ssmLifecycleRole.arn,
runCommandTargets: [{
key: "tag:Terminate",
values: ["midnight"],
}],
});
import pulumi
import json
import pulumi_aws as aws
ssm_lifecycle_trust = aws.iam.get_policy_document(statements=[{
"actions": ["sts:AssumeRole"],
"principals": [{
"type": "Service",
"identifiers": ["events.amazonaws.com"],
}],
}])
stop_instance = aws.ssm.Document("stop_instance",
name="stop_instance",
document_type="Command",
content=json.dumps({
"schemaVersion": "1.2",
"description": "Stop an instance",
"parameters": {},
"runtimeConfig": {
"aws:runShellScript": {
"properties": [{
"id": "0.aws:runShellScript",
"runCommand": ["halt"],
}],
},
},
}))
ssm_lifecycle = aws.iam.get_policy_document_output(statements=[
{
"effect": "Allow",
"actions": ["ssm:SendCommand"],
"resources": ["arn:aws:ec2:eu-west-1:1234567890:instance/*"],
"conditions": [{
"test": "StringEquals",
"variable": "ec2:ResourceTag/Terminate",
"values": ["*"],
}],
},
{
"effect": "Allow",
"actions": ["ssm:SendCommand"],
"resources": [stop_instance.arn],
},
])
ssm_lifecycle_role = aws.iam.Role("ssm_lifecycle",
name="SSMLifecycle",
assume_role_policy=ssm_lifecycle_trust.json)
ssm_lifecycle_policy = aws.iam.Policy("ssm_lifecycle",
name="SSMLifecycle",
policy=ssm_lifecycle.json)
ssm_lifecycle_role_policy_attachment = aws.iam.RolePolicyAttachment("ssm_lifecycle",
policy_arn=ssm_lifecycle_policy.arn,
role=ssm_lifecycle_role.name)
stop_instances = aws.cloudwatch.EventRule("stop_instances",
name="StopInstance",
description="Stop instances nightly",
schedule_expression="cron(0 0 * * ? *)")
stop_instances_event_target = aws.cloudwatch.EventTarget("stop_instances",
target_id="StopInstance",
arn=stop_instance.arn,
rule=stop_instances.name,
role_arn=ssm_lifecycle_role.arn,
run_command_targets=[{
"key": "tag:Terminate",
"values": ["midnight"],
}])
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssm"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
ssmLifecycleTrust, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
Statements: []iam.GetPolicyDocumentStatement{
{
Actions: []string{
"sts:AssumeRole",
},
Principals: []iam.GetPolicyDocumentStatementPrincipal{
{
Type: "Service",
Identifiers: []string{
"events.amazonaws.com",
},
},
},
},
},
}, nil)
if err != nil {
return err
}
tmpJSON0, err := json.Marshal(map[string]interface{}{
"schemaVersion": "1.2",
"description": "Stop an instance",
"parameters": map[string]interface{}{},
"runtimeConfig": map[string]interface{}{
"aws:runShellScript": map[string]interface{}{
"properties": []map[string]interface{}{
map[string]interface{}{
"id": "0.aws:runShellScript",
"runCommand": []string{
"halt",
},
},
},
},
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
stopInstance, err := ssm.NewDocument(ctx, "stop_instance", &ssm.DocumentArgs{
Name: pulumi.String("stop_instance"),
DocumentType: pulumi.String("Command"),
Content: pulumi.String(json0),
})
if err != nil {
return err
}
ssmLifecycle := iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{
Statements: iam.GetPolicyDocumentStatementArray{
&iam.GetPolicyDocumentStatementArgs{
Effect: pulumi.String("Allow"),
Actions: pulumi.StringArray{
pulumi.String("ssm:SendCommand"),
},
Resources: pulumi.StringArray{
pulumi.String("arn:aws:ec2:eu-west-1:1234567890:instance/*"),
},
Conditions: iam.GetPolicyDocumentStatementConditionArray{
&iam.GetPolicyDocumentStatementConditionArgs{
Test: pulumi.String("StringEquals"),
Variable: pulumi.String("ec2:ResourceTag/Terminate"),
Values: pulumi.StringArray{
pulumi.String("*"),
},
},
},
},
&iam.GetPolicyDocumentStatementArgs{
Effect: pulumi.String("Allow"),
Actions: pulumi.StringArray{
pulumi.String("ssm:SendCommand"),
},
Resources: pulumi.StringArray{
stopInstance.Arn,
},
},
},
}, nil)
ssmLifecycleRole, err := iam.NewRole(ctx, "ssm_lifecycle", &iam.RoleArgs{
Name: pulumi.String("SSMLifecycle"),
AssumeRolePolicy: pulumi.String(ssmLifecycleTrust.Json),
})
if err != nil {
return err
}
ssmLifecyclePolicy, err := iam.NewPolicy(ctx, "ssm_lifecycle", &iam.PolicyArgs{
Name: pulumi.String("SSMLifecycle"),
Policy: pulumi.String(ssmLifecycle.ApplyT(func(ssmLifecycle iam.GetPolicyDocumentResult) (*string, error) {
return &ssmLifecycle.Json, nil
}).(pulumi.StringPtrOutput)),
})
if err != nil {
return err
}
_, err = iam.NewRolePolicyAttachment(ctx, "ssm_lifecycle", &iam.RolePolicyAttachmentArgs{
PolicyArn: ssmLifecyclePolicy.Arn,
Role: ssmLifecycleRole.Name,
})
if err != nil {
return err
}
stopInstances, err := cloudwatch.NewEventRule(ctx, "stop_instances", &cloudwatch.EventRuleArgs{
Name: pulumi.String("StopInstance"),
Description: pulumi.String("Stop instances nightly"),
ScheduleExpression: pulumi.String("cron(0 0 * * ? *)"),
})
if err != nil {
return err
}
_, err = cloudwatch.NewEventTarget(ctx, "stop_instances", &cloudwatch.EventTargetArgs{
TargetId: pulumi.String("StopInstance"),
Arn: stopInstance.Arn,
Rule: stopInstances.Name,
RoleArn: ssmLifecycleRole.Arn,
RunCommandTargets: cloudwatch.EventTargetRunCommandTargetArray{
&cloudwatch.EventTargetRunCommandTargetArgs{
Key: pulumi.String("tag:Terminate"),
Values: pulumi.StringArray{
pulumi.String("midnight"),
},
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var ssmLifecycleTrust = Aws.Iam.GetPolicyDocument.Invoke(new()
{
Statements = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Actions = new[]
{
"sts:AssumeRole",
},
Principals = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
{
Type = "Service",
Identifiers = new[]
{
"events.amazonaws.com",
},
},
},
},
},
});
var stopInstance = new Aws.Ssm.Document("stop_instance", new()
{
Name = "stop_instance",
DocumentType = "Command",
Content = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["schemaVersion"] = "1.2",
["description"] = "Stop an instance",
["parameters"] = new Dictionary<string, object?>
{
},
["runtimeConfig"] = new Dictionary<string, object?>
{
["aws:runShellScript"] = new Dictionary<string, object?>
{
["properties"] = new[]
{
new Dictionary<string, object?>
{
["id"] = "0.aws:runShellScript",
["runCommand"] = new[]
{
"halt",
},
},
},
},
},
}),
});
var ssmLifecycle = Aws.Iam.GetPolicyDocument.Invoke(new()
{
Statements = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Effect = "Allow",
Actions = new[]
{
"ssm:SendCommand",
},
Resources = new[]
{
"arn:aws:ec2:eu-west-1:1234567890:instance/*",
},
Conditions = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementConditionInputArgs
{
Test = "StringEquals",
Variable = "ec2:ResourceTag/Terminate",
Values = new[]
{
"*",
},
},
},
},
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Effect = "Allow",
Actions = new[]
{
"ssm:SendCommand",
},
Resources = new[]
{
stopInstance.Arn,
},
},
},
});
var ssmLifecycleRole = new Aws.Iam.Role("ssm_lifecycle", new()
{
Name = "SSMLifecycle",
AssumeRolePolicy = ssmLifecycleTrust.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
});
var ssmLifecyclePolicy = new Aws.Iam.Policy("ssm_lifecycle", new()
{
Name = "SSMLifecycle",
PolicyDocument = ssmLifecycle.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
});
var ssmLifecycleRolePolicyAttachment = new Aws.Iam.RolePolicyAttachment("ssm_lifecycle", new()
{
PolicyArn = ssmLifecyclePolicy.Arn,
Role = ssmLifecycleRole.Name,
});
var stopInstances = new Aws.CloudWatch.EventRule("stop_instances", new()
{
Name = "StopInstance",
Description = "Stop instances nightly",
ScheduleExpression = "cron(0 0 * * ? *)",
});
var stopInstancesEventTarget = new Aws.CloudWatch.EventTarget("stop_instances", new()
{
TargetId = "StopInstance",
Arn = stopInstance.Arn,
Rule = stopInstances.Name,
RoleArn = ssmLifecycleRole.Arn,
RunCommandTargets = new[]
{
new Aws.CloudWatch.Inputs.EventTargetRunCommandTargetArgs
{
Key = "tag:Terminate",
Values = new[]
{
"midnight",
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.ssm.Document;
import com.pulumi.aws.ssm.DocumentArgs;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.iam.Policy;
import com.pulumi.aws.iam.PolicyArgs;
import com.pulumi.aws.iam.RolePolicyAttachment;
import com.pulumi.aws.iam.RolePolicyAttachmentArgs;
import com.pulumi.aws.cloudwatch.EventRule;
import com.pulumi.aws.cloudwatch.EventRuleArgs;
import com.pulumi.aws.cloudwatch.EventTarget;
import com.pulumi.aws.cloudwatch.EventTargetArgs;
import com.pulumi.aws.cloudwatch.inputs.EventTargetRunCommandTargetArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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) {
final var ssmLifecycleTrust = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.actions("sts:AssumeRole")
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("Service")
.identifiers("events.amazonaws.com")
.build())
.build())
.build());
var stopInstance = new Document("stopInstance", DocumentArgs.builder()
.name("stop_instance")
.documentType("Command")
.content(serializeJson(
jsonObject(
jsonProperty("schemaVersion", "1.2"),
jsonProperty("description", "Stop an instance"),
jsonProperty("parameters", jsonObject(
)),
jsonProperty("runtimeConfig", jsonObject(
jsonProperty("aws:runShellScript", jsonObject(
jsonProperty("properties", jsonArray(jsonObject(
jsonProperty("id", "0.aws:runShellScript"),
jsonProperty("runCommand", jsonArray("halt"))
)))
))
))
)))
.build());
final var ssmLifecycle = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(
GetPolicyDocumentStatementArgs.builder()
.effect("Allow")
.actions("ssm:SendCommand")
.resources("arn:aws:ec2:eu-west-1:1234567890:instance/*")
.conditions(GetPolicyDocumentStatementConditionArgs.builder()
.test("StringEquals")
.variable("ec2:ResourceTag/Terminate")
.values("*")
.build())
.build(),
GetPolicyDocumentStatementArgs.builder()
.effect("Allow")
.actions("ssm:SendCommand")
.resources(stopInstance.arn())
.build())
.build());
var ssmLifecycleRole = new Role("ssmLifecycleRole", RoleArgs.builder()
.name("SSMLifecycle")
.assumeRolePolicy(ssmLifecycleTrust.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
.build());
var ssmLifecyclePolicy = new Policy("ssmLifecyclePolicy", PolicyArgs.builder()
.name("SSMLifecycle")
.policy(ssmLifecycle.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult).applyValue(ssmLifecycle -> ssmLifecycle.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json())))
.build());
var ssmLifecycleRolePolicyAttachment = new RolePolicyAttachment("ssmLifecycleRolePolicyAttachment", RolePolicyAttachmentArgs.builder()
.policyArn(ssmLifecyclePolicy.arn())
.role(ssmLifecycleRole.name())
.build());
var stopInstances = new EventRule("stopInstances", EventRuleArgs.builder()
.name("StopInstance")
.description("Stop instances nightly")
.scheduleExpression("cron(0 0 * * ? *)")
.build());
var stopInstancesEventTarget = new EventTarget("stopInstancesEventTarget", EventTargetArgs.builder()
.targetId("StopInstance")
.arn(stopInstance.arn())
.rule(stopInstances.name())
.roleArn(ssmLifecycleRole.arn())
.runCommandTargets(EventTargetRunCommandTargetArgs.builder()
.key("tag:Terminate")
.values("midnight")
.build())
.build());
}
}
resources:
ssmLifecycleRole:
type: aws:iam:Role
name: ssm_lifecycle
properties:
name: SSMLifecycle
assumeRolePolicy: ${ssmLifecycleTrust.json}
ssmLifecyclePolicy:
type: aws:iam:Policy
name: ssm_lifecycle
properties:
name: SSMLifecycle
policy: ${ssmLifecycle.json}
ssmLifecycleRolePolicyAttachment:
type: aws:iam:RolePolicyAttachment
name: ssm_lifecycle
properties:
policyArn: ${ssmLifecyclePolicy.arn}
role: ${ssmLifecycleRole.name}
stopInstance:
type: aws:ssm:Document
name: stop_instance
properties:
name: stop_instance
documentType: Command
content:
fn::toJSON:
schemaVersion: '1.2'
description: Stop an instance
parameters: {}
runtimeConfig:
aws:runShellScript:
properties:
- id: 0.aws:runShellScript
runCommand:
- halt
stopInstances:
type: aws:cloudwatch:EventRule
name: stop_instances
properties:
name: StopInstance
description: Stop instances nightly
scheduleExpression: cron(0 0 * * ? *)
stopInstancesEventTarget:
type: aws:cloudwatch:EventTarget
name: stop_instances
properties:
targetId: StopInstance
arn: ${stopInstance.arn}
rule: ${stopInstances.name}
roleArn: ${ssmLifecycleRole.arn}
runCommandTargets:
- key: tag:Terminate
values:
- midnight
variables:
ssmLifecycleTrust:
fn::invoke:
Function: aws:iam:getPolicyDocument
Arguments:
statements:
- actions:
- sts:AssumeRole
principals:
- type: Service
identifiers:
- events.amazonaws.com
ssmLifecycle:
fn::invoke:
Function: aws:iam:getPolicyDocument
Arguments:
statements:
- effect: Allow
actions:
- ssm:SendCommand
resources:
- arn:aws:ec2:eu-west-1:1234567890:instance/*
conditions:
- test: StringEquals
variable: ec2:ResourceTag/Terminate
values:
- '*'
- effect: Allow
actions:
- ssm:SendCommand
resources:
- ${stopInstance.arn}
RunCommand Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const stopInstances = new aws.cloudwatch.EventRule("stop_instances", {
name: "StopInstance",
description: "Stop instances nightly",
scheduleExpression: "cron(0 0 * * ? *)",
});
const stopInstancesEventTarget = new aws.cloudwatch.EventTarget("stop_instances", {
targetId: "StopInstance",
arn: `arn:aws:ssm:${awsRegion}::document/AWS-RunShellScript`,
input: "{\"commands\":[\"halt\"]}",
rule: stopInstances.name,
roleArn: ssmLifecycle.arn,
runCommandTargets: [{
key: "tag:Terminate",
values: ["midnight"],
}],
});
import pulumi
import pulumi_aws as aws
stop_instances = aws.cloudwatch.EventRule("stop_instances",
name="StopInstance",
description="Stop instances nightly",
schedule_expression="cron(0 0 * * ? *)")
stop_instances_event_target = aws.cloudwatch.EventTarget("stop_instances",
target_id="StopInstance",
arn=f"arn:aws:ssm:{aws_region}::document/AWS-RunShellScript",
input="{\"commands\":[\"halt\"]}",
rule=stop_instances.name,
role_arn=ssm_lifecycle["arn"],
run_command_targets=[{
"key": "tag:Terminate",
"values": ["midnight"],
}])
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
stopInstances, err := cloudwatch.NewEventRule(ctx, "stop_instances", &cloudwatch.EventRuleArgs{
Name: pulumi.String("StopInstance"),
Description: pulumi.String("Stop instances nightly"),
ScheduleExpression: pulumi.String("cron(0 0 * * ? *)"),
})
if err != nil {
return err
}
_, err = cloudwatch.NewEventTarget(ctx, "stop_instances", &cloudwatch.EventTargetArgs{
TargetId: pulumi.String("StopInstance"),
Arn: pulumi.Sprintf("arn:aws:ssm:%v::document/AWS-RunShellScript", awsRegion),
Input: pulumi.String("{\"commands\":[\"halt\"]}"),
Rule: stopInstances.Name,
RoleArn: pulumi.Any(ssmLifecycle.Arn),
RunCommandTargets: cloudwatch.EventTargetRunCommandTargetArray{
&cloudwatch.EventTargetRunCommandTargetArgs{
Key: pulumi.String("tag:Terminate"),
Values: pulumi.StringArray{
pulumi.String("midnight"),
},
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var stopInstances = new Aws.CloudWatch.EventRule("stop_instances", new()
{
Name = "StopInstance",
Description = "Stop instances nightly",
ScheduleExpression = "cron(0 0 * * ? *)",
});
var stopInstancesEventTarget = new Aws.CloudWatch.EventTarget("stop_instances", new()
{
TargetId = "StopInstance",
Arn = $"arn:aws:ssm:{awsRegion}::document/AWS-RunShellScript",
Input = "{\"commands\":[\"halt\"]}",
Rule = stopInstances.Name,
RoleArn = ssmLifecycle.Arn,
RunCommandTargets = new[]
{
new Aws.CloudWatch.Inputs.EventTargetRunCommandTargetArgs
{
Key = "tag:Terminate",
Values = new[]
{
"midnight",
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudwatch.EventRule;
import com.pulumi.aws.cloudwatch.EventRuleArgs;
import com.pulumi.aws.cloudwatch.EventTarget;
import com.pulumi.aws.cloudwatch.EventTargetArgs;
import com.pulumi.aws.cloudwatch.inputs.EventTargetRunCommandTargetArgs;
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 stopInstances = new EventRule("stopInstances", EventRuleArgs.builder()
.name("StopInstance")
.description("Stop instances nightly")
.scheduleExpression("cron(0 0 * * ? *)")
.build());
var stopInstancesEventTarget = new EventTarget("stopInstancesEventTarget", EventTargetArgs.builder()
.targetId("StopInstance")
.arn(String.format("arn:aws:ssm:%s::document/AWS-RunShellScript", awsRegion))
.input("{\"commands\":[\"halt\"]}")
.rule(stopInstances.name())
.roleArn(ssmLifecycle.arn())
.runCommandTargets(EventTargetRunCommandTargetArgs.builder()
.key("tag:Terminate")
.values("midnight")
.build())
.build());
}
}
resources:
stopInstances:
type: aws:cloudwatch:EventRule
name: stop_instances
properties:
name: StopInstance
description: Stop instances nightly
scheduleExpression: cron(0 0 * * ? *)
stopInstancesEventTarget:
type: aws:cloudwatch:EventTarget
name: stop_instances
properties:
targetId: StopInstance
arn: arn:aws:ssm:${awsRegion}::document/AWS-RunShellScript
input: '{"commands":["halt"]}'
rule: ${stopInstances.name}
roleArn: ${ssmLifecycle.arn}
runCommandTargets:
- key: tag:Terminate
values:
- midnight
ECS Run Task with Role and Task Override Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as std from "@pulumi/std";
const assumeRole = aws.iam.getPolicyDocument({
statements: [{
effect: "Allow",
principals: [{
type: "Service",
identifiers: ["events.amazonaws.com"],
}],
actions: ["sts:AssumeRole"],
}],
});
const ecsEvents = new aws.iam.Role("ecs_events", {
name: "ecs_events",
assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json),
});
const ecsEventsRunTaskWithAnyRole = std.replace({
text: taskName.arn,
search: "/:\\d+$/",
replace: ":*",
}).then(invoke => aws.iam.getPolicyDocument({
statements: [
{
effect: "Allow",
actions: ["iam:PassRole"],
resources: ["*"],
},
{
effect: "Allow",
actions: ["ecs:RunTask"],
resources: [invoke.result],
},
],
}));
const ecsEventsRunTaskWithAnyRoleRolePolicy = new aws.iam.RolePolicy("ecs_events_run_task_with_any_role", {
name: "ecs_events_run_task_with_any_role",
role: ecsEvents.id,
policy: ecsEventsRunTaskWithAnyRole.then(ecsEventsRunTaskWithAnyRole => ecsEventsRunTaskWithAnyRole.json),
});
const ecsScheduledTask = new aws.cloudwatch.EventTarget("ecs_scheduled_task", {
targetId: "run-scheduled-task-every-hour",
arn: clusterName.arn,
rule: everyHour.name,
roleArn: ecsEvents.arn,
ecsTarget: {
taskCount: 1,
taskDefinitionArn: taskName.arn,
},
input: JSON.stringify({
containerOverrides: [{
name: "name-of-container-to-override",
command: [
"bin/console",
"scheduled-task",
],
}],
}),
});
import pulumi
import json
import pulumi_aws as aws
import pulumi_std as std
assume_role = aws.iam.get_policy_document(statements=[{
"effect": "Allow",
"principals": [{
"type": "Service",
"identifiers": ["events.amazonaws.com"],
}],
"actions": ["sts:AssumeRole"],
}])
ecs_events = aws.iam.Role("ecs_events",
name="ecs_events",
assume_role_policy=assume_role.json)
ecs_events_run_task_with_any_role = aws.iam.get_policy_document(statements=[
{
"effect": "Allow",
"actions": ["iam:PassRole"],
"resources": ["*"],
},
{
"effect": "Allow",
"actions": ["ecs:RunTask"],
"resources": [std.replace(text=task_name["arn"],
search="/:\\d+$/",
replace=":*").result],
},
])
ecs_events_run_task_with_any_role_role_policy = aws.iam.RolePolicy("ecs_events_run_task_with_any_role",
name="ecs_events_run_task_with_any_role",
role=ecs_events.id,
policy=ecs_events_run_task_with_any_role.json)
ecs_scheduled_task = aws.cloudwatch.EventTarget("ecs_scheduled_task",
target_id="run-scheduled-task-every-hour",
arn=cluster_name["arn"],
rule=every_hour["name"],
role_arn=ecs_events.arn,
ecs_target={
"task_count": 1,
"task_definition_arn": task_name["arn"],
},
input=json.dumps({
"containerOverrides": [{
"name": "name-of-container-to-override",
"command": [
"bin/console",
"scheduled-task",
],
}],
}))
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
"github.com/pulumi/pulumi-std/sdk/go/std"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
Statements: []iam.GetPolicyDocumentStatement{
{
Effect: pulumi.StringRef("Allow"),
Principals: []iam.GetPolicyDocumentStatementPrincipal{
{
Type: "Service",
Identifiers: []string{
"events.amazonaws.com",
},
},
},
Actions: []string{
"sts:AssumeRole",
},
},
},
}, nil);
if err != nil {
return err
}
ecsEvents, err := iam.NewRole(ctx, "ecs_events", &iam.RoleArgs{
Name: pulumi.String("ecs_events"),
AssumeRolePolicy: pulumi.String(assumeRole.Json),
})
if err != nil {
return err
}
ecsEventsRunTaskWithAnyRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
Statements: []iam.GetPolicyDocumentStatement{
{
Effect: pulumi.StringRef("Allow"),
Actions: []string{
"iam:PassRole",
},
Resources: []string{
"*",
},
},
{
Effect: pulumi.StringRef("Allow"),
Actions: []string{
"ecs:RunTask",
},
Resources: interface{}{
std.Replace(ctx, {
Text: taskName.Arn,
Search: "/:\\d+$/",
Replace: ":*",
}, nil).Result,
},
},
},
}, nil);
if err != nil {
return err
}
_, err = iam.NewRolePolicy(ctx, "ecs_events_run_task_with_any_role", &iam.RolePolicyArgs{
Name: pulumi.String("ecs_events_run_task_with_any_role"),
Role: ecsEvents.ID(),
Policy: pulumi.String(ecsEventsRunTaskWithAnyRole.Json),
})
if err != nil {
return err
}
tmpJSON0, err := json.Marshal(map[string]interface{}{
"containerOverrides": []map[string]interface{}{
map[string]interface{}{
"name": "name-of-container-to-override",
"command": []string{
"bin/console",
"scheduled-task",
},
},
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = cloudwatch.NewEventTarget(ctx, "ecs_scheduled_task", &cloudwatch.EventTargetArgs{
TargetId: pulumi.String("run-scheduled-task-every-hour"),
Arn: pulumi.Any(clusterName.Arn),
Rule: pulumi.Any(everyHour.Name),
RoleArn: ecsEvents.Arn,
EcsTarget: &cloudwatch.EventTargetEcsTargetArgs{
TaskCount: pulumi.Int(1),
TaskDefinitionArn: pulumi.Any(taskName.Arn),
},
Input: pulumi.String(json0),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;
using Std = Pulumi.Std;
return await Deployment.RunAsync(() =>
{
var assumeRole = Aws.Iam.GetPolicyDocument.Invoke(new()
{
Statements = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Effect = "Allow",
Principals = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
{
Type = "Service",
Identifiers = new[]
{
"events.amazonaws.com",
},
},
},
Actions = new[]
{
"sts:AssumeRole",
},
},
},
});
var ecsEvents = new Aws.Iam.Role("ecs_events", new()
{
Name = "ecs_events",
AssumeRolePolicy = assumeRole.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
});
var ecsEventsRunTaskWithAnyRole = Aws.Iam.GetPolicyDocument.Invoke(new()
{
Statements = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Effect = "Allow",
Actions = new[]
{
"iam:PassRole",
},
Resources = new[]
{
"*",
},
},
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Effect = "Allow",
Actions = new[]
{
"ecs:RunTask",
},
Resources = new[]
{
Std.Replace.Invoke(new()
{
Text = taskName.Arn,
Search = "/:\\d+$/",
Replace = ":*",
}).Result,
},
},
},
});
var ecsEventsRunTaskWithAnyRoleRolePolicy = new Aws.Iam.RolePolicy("ecs_events_run_task_with_any_role", new()
{
Name = "ecs_events_run_task_with_any_role",
Role = ecsEvents.Id,
Policy = ecsEventsRunTaskWithAnyRole.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
});
var ecsScheduledTask = new Aws.CloudWatch.EventTarget("ecs_scheduled_task", new()
{
TargetId = "run-scheduled-task-every-hour",
Arn = clusterName.Arn,
Rule = everyHour.Name,
RoleArn = ecsEvents.Arn,
EcsTarget = new Aws.CloudWatch.Inputs.EventTargetEcsTargetArgs
{
TaskCount = 1,
TaskDefinitionArn = taskName.Arn,
},
Input = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["containerOverrides"] = new[]
{
new Dictionary<string, object?>
{
["name"] = "name-of-container-to-override",
["command"] = new[]
{
"bin/console",
"scheduled-task",
},
},
},
}),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
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.cloudwatch.EventTarget;
import com.pulumi.aws.cloudwatch.EventTargetArgs;
import com.pulumi.aws.cloudwatch.inputs.EventTargetEcsTargetArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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) {
final var assumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.effect("Allow")
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("Service")
.identifiers("events.amazonaws.com")
.build())
.actions("sts:AssumeRole")
.build())
.build());
var ecsEvents = new Role("ecsEvents", RoleArgs.builder()
.name("ecs_events")
.assumeRolePolicy(assumeRole.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
.build());
final var ecsEventsRunTaskWithAnyRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(
GetPolicyDocumentStatementArgs.builder()
.effect("Allow")
.actions("iam:PassRole")
.resources("*")
.build(),
GetPolicyDocumentStatementArgs.builder()
.effect("Allow")
.actions("ecs:RunTask")
.resources(StdFunctions.replace(ReplaceArgs.builder()
.text(taskName.arn())
.search("/:\\d+$/")
.replace(":*")
.build()).result())
.build())
.build());
var ecsEventsRunTaskWithAnyRoleRolePolicy = new RolePolicy("ecsEventsRunTaskWithAnyRoleRolePolicy", RolePolicyArgs.builder()
.name("ecs_events_run_task_with_any_role")
.role(ecsEvents.id())
.policy(ecsEventsRunTaskWithAnyRole.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
.build());
var ecsScheduledTask = new EventTarget("ecsScheduledTask", EventTargetArgs.builder()
.targetId("run-scheduled-task-every-hour")
.arn(clusterName.arn())
.rule(everyHour.name())
.roleArn(ecsEvents.arn())
.ecsTarget(EventTargetEcsTargetArgs.builder()
.taskCount(1)
.taskDefinitionArn(taskName.arn())
.build())
.input(serializeJson(
jsonObject(
jsonProperty("containerOverrides", jsonArray(jsonObject(
jsonProperty("name", "name-of-container-to-override"),
jsonProperty("command", jsonArray(
"bin/console",
"scheduled-task"
))
)))
)))
.build());
}
}
resources:
ecsEvents:
type: aws:iam:Role
name: ecs_events
properties:
name: ecs_events
assumeRolePolicy: ${assumeRole.json}
ecsEventsRunTaskWithAnyRoleRolePolicy:
type: aws:iam:RolePolicy
name: ecs_events_run_task_with_any_role
properties:
name: ecs_events_run_task_with_any_role
role: ${ecsEvents.id}
policy: ${ecsEventsRunTaskWithAnyRole.json}
ecsScheduledTask:
type: aws:cloudwatch:EventTarget
name: ecs_scheduled_task
properties:
targetId: run-scheduled-task-every-hour
arn: ${clusterName.arn}
rule: ${everyHour.name}
roleArn: ${ecsEvents.arn}
ecsTarget:
taskCount: 1
taskDefinitionArn: ${taskName.arn}
input:
fn::toJSON:
containerOverrides:
- name: name-of-container-to-override
command:
- bin/console
- scheduled-task
variables:
assumeRole:
fn::invoke:
Function: aws:iam:getPolicyDocument
Arguments:
statements:
- effect: Allow
principals:
- type: Service
identifiers:
- events.amazonaws.com
actions:
- sts:AssumeRole
ecsEventsRunTaskWithAnyRole:
fn::invoke:
Function: aws:iam:getPolicyDocument
Arguments:
statements:
- effect: Allow
actions:
- iam:PassRole
resources:
- '*'
- effect: Allow
actions:
- ecs:RunTask
resources:
- fn::invoke:
Function: std:replace
Arguments:
text: ${taskName.arn}
search: /:\d+$/
replace: :*
Return: result
API Gateway target
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const exampleEventRule = new aws.cloudwatch.EventRule("example", {});
const exampleDeployment = new aws.apigateway.Deployment("example", {restApi: exampleAwsApiGatewayRestApi.id});
const exampleStage = new aws.apigateway.Stage("example", {
restApi: exampleAwsApiGatewayRestApi.id,
deployment: exampleDeployment.id,
});
const example = new aws.cloudwatch.EventTarget("example", {
arn: pulumi.interpolate`${exampleStage.executionArn}/GET`,
rule: exampleEventRule.id,
httpTarget: {
queryStringParameters: {
Body: "$.detail.body",
},
headerParameters: {
Env: "Test",
},
},
});
import pulumi
import pulumi_aws as aws
example_event_rule = aws.cloudwatch.EventRule("example")
example_deployment = aws.apigateway.Deployment("example", rest_api=example_aws_api_gateway_rest_api["id"])
example_stage = aws.apigateway.Stage("example",
rest_api=example_aws_api_gateway_rest_api["id"],
deployment=example_deployment.id)
example = aws.cloudwatch.EventTarget("example",
arn=example_stage.execution_arn.apply(lambda execution_arn: f"{execution_arn}/GET"),
rule=example_event_rule.id,
http_target={
"query_string_parameters": {
"Body": "$.detail.body",
},
"header_parameters": {
"Env": "Test",
},
})
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigateway"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleEventRule, err := cloudwatch.NewEventRule(ctx, "example", nil)
if err != nil {
return err
}
exampleDeployment, err := apigateway.NewDeployment(ctx, "example", &apigateway.DeploymentArgs{
RestApi: pulumi.Any(exampleAwsApiGatewayRestApi.Id),
})
if err != nil {
return err
}
exampleStage, err := apigateway.NewStage(ctx, "example", &apigateway.StageArgs{
RestApi: pulumi.Any(exampleAwsApiGatewayRestApi.Id),
Deployment: exampleDeployment.ID(),
})
if err != nil {
return err
}
_, err = cloudwatch.NewEventTarget(ctx, "example", &cloudwatch.EventTargetArgs{
Arn: exampleStage.ExecutionArn.ApplyT(func(executionArn string) (string, error) {
return fmt.Sprintf("%v/GET", executionArn), nil
}).(pulumi.StringOutput),
Rule: exampleEventRule.ID(),
HttpTarget: &cloudwatch.EventTargetHttpTargetArgs{
QueryStringParameters: pulumi.StringMap{
"Body": pulumi.String("$.detail.body"),
},
HeaderParameters: pulumi.StringMap{
"Env": pulumi.String("Test"),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var exampleEventRule = new Aws.CloudWatch.EventRule("example");
var exampleDeployment = new Aws.ApiGateway.Deployment("example", new()
{
RestApi = exampleAwsApiGatewayRestApi.Id,
});
var exampleStage = new Aws.ApiGateway.Stage("example", new()
{
RestApi = exampleAwsApiGatewayRestApi.Id,
Deployment = exampleDeployment.Id,
});
var example = new Aws.CloudWatch.EventTarget("example", new()
{
Arn = exampleStage.ExecutionArn.Apply(executionArn => $"{executionArn}/GET"),
Rule = exampleEventRule.Id,
HttpTarget = new Aws.CloudWatch.Inputs.EventTargetHttpTargetArgs
{
QueryStringParameters =
{
{ "Body", "$.detail.body" },
},
HeaderParameters =
{
{ "Env", "Test" },
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudwatch.EventRule;
import com.pulumi.aws.apigateway.Deployment;
import com.pulumi.aws.apigateway.DeploymentArgs;
import com.pulumi.aws.apigateway.Stage;
import com.pulumi.aws.apigateway.StageArgs;
import com.pulumi.aws.cloudwatch.EventTarget;
import com.pulumi.aws.cloudwatch.EventTargetArgs;
import com.pulumi.aws.cloudwatch.inputs.EventTargetHttpTargetArgs;
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 exampleEventRule = new EventRule("exampleEventRule");
var exampleDeployment = new Deployment("exampleDeployment", DeploymentArgs.builder()
.restApi(exampleAwsApiGatewayRestApi.id())
.build());
var exampleStage = new Stage("exampleStage", StageArgs.builder()
.restApi(exampleAwsApiGatewayRestApi.id())
.deployment(exampleDeployment.id())
.build());
var example = new EventTarget("example", EventTargetArgs.builder()
.arn(exampleStage.executionArn().applyValue(executionArn -> String.format("%s/GET", executionArn)))
.rule(exampleEventRule.id())
.httpTarget(EventTargetHttpTargetArgs.builder()
.queryStringParameters(Map.of("Body", "$.detail.body"))
.headerParameters(Map.of("Env", "Test"))
.build())
.build());
}
}
resources:
example:
type: aws:cloudwatch:EventTarget
properties:
arn: ${exampleStage.executionArn}/GET
rule: ${exampleEventRule.id}
httpTarget:
queryStringParameters:
Body: $.detail.body
headerParameters:
Env: Test
exampleEventRule:
type: aws:cloudwatch:EventRule
name: example
exampleDeployment:
type: aws:apigateway:Deployment
name: example
properties:
restApi: ${exampleAwsApiGatewayRestApi.id}
exampleStage:
type: aws:apigateway:Stage
name: example
properties:
restApi: ${exampleAwsApiGatewayRestApi.id}
deployment: ${exampleDeployment.id}
Cross-Account Event Bus target
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const assumeRole = aws.iam.getPolicyDocument({
statements: [{
effect: "Allow",
principals: [{
type: "Service",
identifiers: ["events.amazonaws.com"],
}],
actions: ["sts:AssumeRole"],
}],
});
const eventBusInvokeRemoteEventBusRole = new aws.iam.Role("event_bus_invoke_remote_event_bus", {
name: "event-bus-invoke-remote-event-bus",
assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json),
});
const eventBusInvokeRemoteEventBus = aws.iam.getPolicyDocument({
statements: [{
effect: "Allow",
actions: ["events:PutEvents"],
resources: ["arn:aws:events:eu-west-1:1234567890:event-bus/My-Event-Bus"],
}],
});
const eventBusInvokeRemoteEventBusPolicy = new aws.iam.Policy("event_bus_invoke_remote_event_bus", {
name: "event_bus_invoke_remote_event_bus",
policy: eventBusInvokeRemoteEventBus.then(eventBusInvokeRemoteEventBus => eventBusInvokeRemoteEventBus.json),
});
const eventBusInvokeRemoteEventBusRolePolicyAttachment = new aws.iam.RolePolicyAttachment("event_bus_invoke_remote_event_bus", {
role: eventBusInvokeRemoteEventBusRole.name,
policyArn: eventBusInvokeRemoteEventBusPolicy.arn,
});
const stopInstances = new aws.cloudwatch.EventRule("stop_instances", {
name: "StopInstance",
description: "Stop instances nightly",
scheduleExpression: "cron(0 0 * * ? *)",
});
const stopInstancesEventTarget = new aws.cloudwatch.EventTarget("stop_instances", {
targetId: "StopInstance",
arn: "arn:aws:events:eu-west-1:1234567890:event-bus/My-Event-Bus",
rule: stopInstances.name,
roleArn: eventBusInvokeRemoteEventBusRole.arn,
});
import pulumi
import pulumi_aws as aws
assume_role = aws.iam.get_policy_document(statements=[{
"effect": "Allow",
"principals": [{
"type": "Service",
"identifiers": ["events.amazonaws.com"],
}],
"actions": ["sts:AssumeRole"],
}])
event_bus_invoke_remote_event_bus_role = aws.iam.Role("event_bus_invoke_remote_event_bus",
name="event-bus-invoke-remote-event-bus",
assume_role_policy=assume_role.json)
event_bus_invoke_remote_event_bus = aws.iam.get_policy_document(statements=[{
"effect": "Allow",
"actions": ["events:PutEvents"],
"resources": ["arn:aws:events:eu-west-1:1234567890:event-bus/My-Event-Bus"],
}])
event_bus_invoke_remote_event_bus_policy = aws.iam.Policy("event_bus_invoke_remote_event_bus",
name="event_bus_invoke_remote_event_bus",
policy=event_bus_invoke_remote_event_bus.json)
event_bus_invoke_remote_event_bus_role_policy_attachment = aws.iam.RolePolicyAttachment("event_bus_invoke_remote_event_bus",
role=event_bus_invoke_remote_event_bus_role.name,
policy_arn=event_bus_invoke_remote_event_bus_policy.arn)
stop_instances = aws.cloudwatch.EventRule("stop_instances",
name="StopInstance",
description="Stop instances nightly",
schedule_expression="cron(0 0 * * ? *)")
stop_instances_event_target = aws.cloudwatch.EventTarget("stop_instances",
target_id="StopInstance",
arn="arn:aws:events:eu-west-1:1234567890:event-bus/My-Event-Bus",
rule=stop_instances.name,
role_arn=event_bus_invoke_remote_event_bus_role.arn)
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
Statements: []iam.GetPolicyDocumentStatement{
{
Effect: pulumi.StringRef("Allow"),
Principals: []iam.GetPolicyDocumentStatementPrincipal{
{
Type: "Service",
Identifiers: []string{
"events.amazonaws.com",
},
},
},
Actions: []string{
"sts:AssumeRole",
},
},
},
}, nil)
if err != nil {
return err
}
eventBusInvokeRemoteEventBusRole, err := iam.NewRole(ctx, "event_bus_invoke_remote_event_bus", &iam.RoleArgs{
Name: pulumi.String("event-bus-invoke-remote-event-bus"),
AssumeRolePolicy: pulumi.String(assumeRole.Json),
})
if err != nil {
return err
}
eventBusInvokeRemoteEventBus, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
Statements: []iam.GetPolicyDocumentStatement{
{
Effect: pulumi.StringRef("Allow"),
Actions: []string{
"events:PutEvents",
},
Resources: []string{
"arn:aws:events:eu-west-1:1234567890:event-bus/My-Event-Bus",
},
},
},
}, nil)
if err != nil {
return err
}
eventBusInvokeRemoteEventBusPolicy, err := iam.NewPolicy(ctx, "event_bus_invoke_remote_event_bus", &iam.PolicyArgs{
Name: pulumi.String("event_bus_invoke_remote_event_bus"),
Policy: pulumi.String(eventBusInvokeRemoteEventBus.Json),
})
if err != nil {
return err
}
_, err = iam.NewRolePolicyAttachment(ctx, "event_bus_invoke_remote_event_bus", &iam.RolePolicyAttachmentArgs{
Role: eventBusInvokeRemoteEventBusRole.Name,
PolicyArn: eventBusInvokeRemoteEventBusPolicy.Arn,
})
if err != nil {
return err
}
stopInstances, err := cloudwatch.NewEventRule(ctx, "stop_instances", &cloudwatch.EventRuleArgs{
Name: pulumi.String("StopInstance"),
Description: pulumi.String("Stop instances nightly"),
ScheduleExpression: pulumi.String("cron(0 0 * * ? *)"),
})
if err != nil {
return err
}
_, err = cloudwatch.NewEventTarget(ctx, "stop_instances", &cloudwatch.EventTargetArgs{
TargetId: pulumi.String("StopInstance"),
Arn: pulumi.String("arn:aws:events:eu-west-1:1234567890:event-bus/My-Event-Bus"),
Rule: stopInstances.Name,
RoleArn: eventBusInvokeRemoteEventBusRole.Arn,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var assumeRole = Aws.Iam.GetPolicyDocument.Invoke(new()
{
Statements = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Effect = "Allow",
Principals = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
{
Type = "Service",
Identifiers = new[]
{
"events.amazonaws.com",
},
},
},
Actions = new[]
{
"sts:AssumeRole",
},
},
},
});
var eventBusInvokeRemoteEventBusRole = new Aws.Iam.Role("event_bus_invoke_remote_event_bus", new()
{
Name = "event-bus-invoke-remote-event-bus",
AssumeRolePolicy = assumeRole.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
});
var eventBusInvokeRemoteEventBus = Aws.Iam.GetPolicyDocument.Invoke(new()
{
Statements = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Effect = "Allow",
Actions = new[]
{
"events:PutEvents",
},
Resources = new[]
{
"arn:aws:events:eu-west-1:1234567890:event-bus/My-Event-Bus",
},
},
},
});
var eventBusInvokeRemoteEventBusPolicy = new Aws.Iam.Policy("event_bus_invoke_remote_event_bus", new()
{
Name = "event_bus_invoke_remote_event_bus",
PolicyDocument = eventBusInvokeRemoteEventBus.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
});
var eventBusInvokeRemoteEventBusRolePolicyAttachment = new Aws.Iam.RolePolicyAttachment("event_bus_invoke_remote_event_bus", new()
{
Role = eventBusInvokeRemoteEventBusRole.Name,
PolicyArn = eventBusInvokeRemoteEventBusPolicy.Arn,
});
var stopInstances = new Aws.CloudWatch.EventRule("stop_instances", new()
{
Name = "StopInstance",
Description = "Stop instances nightly",
ScheduleExpression = "cron(0 0 * * ? *)",
});
var stopInstancesEventTarget = new Aws.CloudWatch.EventTarget("stop_instances", new()
{
TargetId = "StopInstance",
Arn = "arn:aws:events:eu-west-1:1234567890:event-bus/My-Event-Bus",
Rule = stopInstances.Name,
RoleArn = eventBusInvokeRemoteEventBusRole.Arn,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.iam.Policy;
import com.pulumi.aws.iam.PolicyArgs;
import com.pulumi.aws.iam.RolePolicyAttachment;
import com.pulumi.aws.iam.RolePolicyAttachmentArgs;
import com.pulumi.aws.cloudwatch.EventRule;
import com.pulumi.aws.cloudwatch.EventRuleArgs;
import com.pulumi.aws.cloudwatch.EventTarget;
import com.pulumi.aws.cloudwatch.EventTargetArgs;
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) {
final var assumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.effect("Allow")
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("Service")
.identifiers("events.amazonaws.com")
.build())
.actions("sts:AssumeRole")
.build())
.build());
var eventBusInvokeRemoteEventBusRole = new Role("eventBusInvokeRemoteEventBusRole", RoleArgs.builder()
.name("event-bus-invoke-remote-event-bus")
.assumeRolePolicy(assumeRole.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
.build());
final var eventBusInvokeRemoteEventBus = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.effect("Allow")
.actions("events:PutEvents")
.resources("arn:aws:events:eu-west-1:1234567890:event-bus/My-Event-Bus")
.build())
.build());
var eventBusInvokeRemoteEventBusPolicy = new Policy("eventBusInvokeRemoteEventBusPolicy", PolicyArgs.builder()
.name("event_bus_invoke_remote_event_bus")
.policy(eventBusInvokeRemoteEventBus.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
.build());
var eventBusInvokeRemoteEventBusRolePolicyAttachment = new RolePolicyAttachment("eventBusInvokeRemoteEventBusRolePolicyAttachment", RolePolicyAttachmentArgs.builder()
.role(eventBusInvokeRemoteEventBusRole.name())
.policyArn(eventBusInvokeRemoteEventBusPolicy.arn())
.build());
var stopInstances = new EventRule("stopInstances", EventRuleArgs.builder()
.name("StopInstance")
.description("Stop instances nightly")
.scheduleExpression("cron(0 0 * * ? *)")
.build());
var stopInstancesEventTarget = new EventTarget("stopInstancesEventTarget", EventTargetArgs.builder()
.targetId("StopInstance")
.arn("arn:aws:events:eu-west-1:1234567890:event-bus/My-Event-Bus")
.rule(stopInstances.name())
.roleArn(eventBusInvokeRemoteEventBusRole.arn())
.build());
}
}
resources:
eventBusInvokeRemoteEventBusRole:
type: aws:iam:Role
name: event_bus_invoke_remote_event_bus
properties:
name: event-bus-invoke-remote-event-bus
assumeRolePolicy: ${assumeRole.json}
eventBusInvokeRemoteEventBusPolicy:
type: aws:iam:Policy
name: event_bus_invoke_remote_event_bus
properties:
name: event_bus_invoke_remote_event_bus
policy: ${eventBusInvokeRemoteEventBus.json}
eventBusInvokeRemoteEventBusRolePolicyAttachment:
type: aws:iam:RolePolicyAttachment
name: event_bus_invoke_remote_event_bus
properties:
role: ${eventBusInvokeRemoteEventBusRole.name}
policyArn: ${eventBusInvokeRemoteEventBusPolicy.arn}
stopInstances:
type: aws:cloudwatch:EventRule
name: stop_instances
properties:
name: StopInstance
description: Stop instances nightly
scheduleExpression: cron(0 0 * * ? *)
stopInstancesEventTarget:
type: aws:cloudwatch:EventTarget
name: stop_instances
properties:
targetId: StopInstance
arn: arn:aws:events:eu-west-1:1234567890:event-bus/My-Event-Bus
rule: ${stopInstances.name}
roleArn: ${eventBusInvokeRemoteEventBusRole.arn}
variables:
assumeRole:
fn::invoke:
Function: aws:iam:getPolicyDocument
Arguments:
statements:
- effect: Allow
principals:
- type: Service
identifiers:
- events.amazonaws.com
actions:
- sts:AssumeRole
eventBusInvokeRemoteEventBus:
fn::invoke:
Function: aws:iam:getPolicyDocument
Arguments:
statements:
- effect: Allow
actions:
- events:PutEvents
resources:
- arn:aws:events:eu-west-1:1234567890:event-bus/My-Event-Bus
Input Transformer Usage - JSON Object
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const exampleEventRule = new aws.cloudwatch.EventRule("example", {});
const example = new aws.cloudwatch.EventTarget("example", {
arn: exampleAwsLambdaFunction.arn,
rule: exampleEventRule.id,
inputTransformer: {
inputPaths: {
instance: "$.detail.instance",
status: "$.detail.status",
},
inputTemplate: `{
"instance_id": <instance>,
"instance_status": <status>
}
`,
},
});
import pulumi
import pulumi_aws as aws
example_event_rule = aws.cloudwatch.EventRule("example")
example = aws.cloudwatch.EventTarget("example",
arn=example_aws_lambda_function["arn"],
rule=example_event_rule.id,
input_transformer={
"input_paths": {
"instance": "$.detail.instance",
"status": "$.detail.status",
},
"input_template": """{
"instance_id": <instance>,
"instance_status": <status>
}
""",
})
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleEventRule, err := cloudwatch.NewEventRule(ctx, "example", nil)
if err != nil {
return err
}
_, err = cloudwatch.NewEventTarget(ctx, "example", &cloudwatch.EventTargetArgs{
Arn: pulumi.Any(exampleAwsLambdaFunction.Arn),
Rule: exampleEventRule.ID(),
InputTransformer: &cloudwatch.EventTargetInputTransformerArgs{
InputPaths: pulumi.StringMap{
"instance": pulumi.String("$.detail.instance"),
"status": pulumi.String("$.detail.status"),
},
InputTemplate: pulumi.String("{\n \"instance_id\": <instance>,\n \"instance_status\": <status>\n}\n"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var exampleEventRule = new Aws.CloudWatch.EventRule("example");
var example = new Aws.CloudWatch.EventTarget("example", new()
{
Arn = exampleAwsLambdaFunction.Arn,
Rule = exampleEventRule.Id,
InputTransformer = new Aws.CloudWatch.Inputs.EventTargetInputTransformerArgs
{
InputPaths =
{
{ "instance", "$.detail.instance" },
{ "status", "$.detail.status" },
},
InputTemplate = @"{
""instance_id"": <instance>,
""instance_status"": <status>
}
",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudwatch.EventRule;
import com.pulumi.aws.cloudwatch.EventTarget;
import com.pulumi.aws.cloudwatch.EventTargetArgs;
import com.pulumi.aws.cloudwatch.inputs.EventTargetInputTransformerArgs;
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 exampleEventRule = new EventRule("exampleEventRule");
var example = new EventTarget("example", EventTargetArgs.builder()
.arn(exampleAwsLambdaFunction.arn())
.rule(exampleEventRule.id())
.inputTransformer(EventTargetInputTransformerArgs.builder()
.inputPaths(Map.ofEntries(
Map.entry("instance", "$.detail.instance"),
Map.entry("status", "$.detail.status")
))
.inputTemplate("""
{
"instance_id": <instance>,
"instance_status": <status>
}
""")
.build())
.build());
}
}
resources:
example:
type: aws:cloudwatch:EventTarget
properties:
arn: ${exampleAwsLambdaFunction.arn}
rule: ${exampleEventRule.id}
inputTransformer:
inputPaths:
instance: $.detail.instance
status: $.detail.status
inputTemplate: |
{
"instance_id": <instance>,
"instance_status": <status>
}
exampleEventRule:
type: aws:cloudwatch:EventRule
name: example
Input Transformer Usage - Simple String
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const exampleEventRule = new aws.cloudwatch.EventRule("example", {});
const example = new aws.cloudwatch.EventTarget("example", {
arn: exampleAwsLambdaFunction.arn,
rule: exampleEventRule.id,
inputTransformer: {
inputPaths: {
instance: "$.detail.instance",
status: "$.detail.status",
},
inputTemplate: "\"<instance> is in state <status>\"",
},
});
import pulumi
import pulumi_aws as aws
example_event_rule = aws.cloudwatch.EventRule("example")
example = aws.cloudwatch.EventTarget("example",
arn=example_aws_lambda_function["arn"],
rule=example_event_rule.id,
input_transformer={
"input_paths": {
"instance": "$.detail.instance",
"status": "$.detail.status",
},
"input_template": "\"<instance> is in state <status>\"",
})
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleEventRule, err := cloudwatch.NewEventRule(ctx, "example", nil)
if err != nil {
return err
}
_, err = cloudwatch.NewEventTarget(ctx, "example", &cloudwatch.EventTargetArgs{
Arn: pulumi.Any(exampleAwsLambdaFunction.Arn),
Rule: exampleEventRule.ID(),
InputTransformer: &cloudwatch.EventTargetInputTransformerArgs{
InputPaths: pulumi.StringMap{
"instance": pulumi.String("$.detail.instance"),
"status": pulumi.String("$.detail.status"),
},
InputTemplate: pulumi.String("\"<instance> is in state <status>\""),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var exampleEventRule = new Aws.CloudWatch.EventRule("example");
var example = new Aws.CloudWatch.EventTarget("example", new()
{
Arn = exampleAwsLambdaFunction.Arn,
Rule = exampleEventRule.Id,
InputTransformer = new Aws.CloudWatch.Inputs.EventTargetInputTransformerArgs
{
InputPaths =
{
{ "instance", "$.detail.instance" },
{ "status", "$.detail.status" },
},
InputTemplate = "\"<instance> is in state <status>\"",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudwatch.EventRule;
import com.pulumi.aws.cloudwatch.EventTarget;
import com.pulumi.aws.cloudwatch.EventTargetArgs;
import com.pulumi.aws.cloudwatch.inputs.EventTargetInputTransformerArgs;
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 exampleEventRule = new EventRule("exampleEventRule");
var example = new EventTarget("example", EventTargetArgs.builder()
.arn(exampleAwsLambdaFunction.arn())
.rule(exampleEventRule.id())
.inputTransformer(EventTargetInputTransformerArgs.builder()
.inputPaths(Map.ofEntries(
Map.entry("instance", "$.detail.instance"),
Map.entry("status", "$.detail.status")
))
.inputTemplate("\"<instance> is in state <status>\"")
.build())
.build());
}
}
resources:
example:
type: aws:cloudwatch:EventTarget
properties:
arn: ${exampleAwsLambdaFunction.arn}
rule: ${exampleEventRule.id}
inputTransformer:
inputPaths:
instance: $.detail.instance
status: $.detail.status
inputTemplate: '"<instance> is in state <status>"'
exampleEventRule:
type: aws:cloudwatch:EventRule
name: example
Cloudwatch Log Group Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.cloudwatch.LogGroup("example", {
name: "/aws/events/guardduty/logs",
retentionInDays: 1,
});
const exampleEventRule = new aws.cloudwatch.EventRule("example", {
name: "guard-duty_event_rule",
description: "GuardDuty Findings",
eventPattern: JSON.stringify({
source: ["aws.guardduty"],
}),
tags: {
Environment: "example",
},
});
const exampleLogPolicy = aws.iam.getPolicyDocumentOutput({
statements: [
{
effect: "Allow",
actions: ["logs:CreateLogStream"],
resources: [pulumi.interpolate`${example.arn}:*`],
principals: [{
type: "Service",
identifiers: [
"events.amazonaws.com",
"delivery.logs.amazonaws.com",
],
}],
},
{
effect: "Allow",
actions: ["logs:PutLogEvents"],
resources: [pulumi.interpolate`${example.arn}:*:*`],
principals: [{
type: "Service",
identifiers: [
"events.amazonaws.com",
"delivery.logs.amazonaws.com",
],
}],
conditions: [{
test: "ArnEquals",
values: [exampleEventRule.arn],
variable: "aws:SourceArn",
}],
},
],
});
const exampleLogResourcePolicy = new aws.cloudwatch.LogResourcePolicy("example", {
policyDocument: exampleLogPolicy.apply(exampleLogPolicy => exampleLogPolicy.json),
policyName: "guardduty-log-publishing-policy",
});
const exampleEventTarget = new aws.cloudwatch.EventTarget("example", {
rule: exampleEventRule.name,
arn: example.arn,
});
import pulumi
import json
import pulumi_aws as aws
example = aws.cloudwatch.LogGroup("example",
name="/aws/events/guardduty/logs",
retention_in_days=1)
example_event_rule = aws.cloudwatch.EventRule("example",
name="guard-duty_event_rule",
description="GuardDuty Findings",
event_pattern=json.dumps({
"source": ["aws.guardduty"],
}),
tags={
"Environment": "example",
})
example_log_policy = aws.iam.get_policy_document_output(statements=[
{
"effect": "Allow",
"actions": ["logs:CreateLogStream"],
"resources": [example.arn.apply(lambda arn: f"{arn}:*")],
"principals": [{
"type": "Service",
"identifiers": [
"events.amazonaws.com",
"delivery.logs.amazonaws.com",
],
}],
},
{
"effect": "Allow",
"actions": ["logs:PutLogEvents"],
"resources": [example.arn.apply(lambda arn: f"{arn}:*:*")],
"principals": [{
"type": "Service",
"identifiers": [
"events.amazonaws.com",
"delivery.logs.amazonaws.com",
],
}],
"conditions": [{
"test": "ArnEquals",
"values": [example_event_rule.arn],
"variable": "aws:SourceArn",
}],
},
])
example_log_resource_policy = aws.cloudwatch.LogResourcePolicy("example",
policy_document=example_log_policy.json,
policy_name="guardduty-log-publishing-policy")
example_event_target = aws.cloudwatch.EventTarget("example",
rule=example_event_rule.name,
arn=example.arn)
package main
import (
"encoding/json"
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := cloudwatch.NewLogGroup(ctx, "example", &cloudwatch.LogGroupArgs{
Name: pulumi.String("/aws/events/guardduty/logs"),
RetentionInDays: pulumi.Int(1),
})
if err != nil {
return err
}
tmpJSON0, err := json.Marshal(map[string]interface{}{
"source": []string{
"aws.guardduty",
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
exampleEventRule, err := cloudwatch.NewEventRule(ctx, "example", &cloudwatch.EventRuleArgs{
Name: pulumi.String("guard-duty_event_rule"),
Description: pulumi.String("GuardDuty Findings"),
EventPattern: pulumi.String(json0),
Tags: pulumi.StringMap{
"Environment": pulumi.String("example"),
},
})
if err != nil {
return err
}
exampleLogPolicy := iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{
Statements: iam.GetPolicyDocumentStatementArray{
&iam.GetPolicyDocumentStatementArgs{
Effect: pulumi.String("Allow"),
Actions: pulumi.StringArray{
pulumi.String("logs:CreateLogStream"),
},
Resources: pulumi.StringArray{
example.Arn.ApplyT(func(arn string) (string, error) {
return fmt.Sprintf("%v:*", arn), nil
}).(pulumi.StringOutput),
},
Principals: iam.GetPolicyDocumentStatementPrincipalArray{
&iam.GetPolicyDocumentStatementPrincipalArgs{
Type: pulumi.String("Service"),
Identifiers: pulumi.StringArray{
pulumi.String("events.amazonaws.com"),
pulumi.String("delivery.logs.amazonaws.com"),
},
},
},
},
&iam.GetPolicyDocumentStatementArgs{
Effect: pulumi.String("Allow"),
Actions: pulumi.StringArray{
pulumi.String("logs:PutLogEvents"),
},
Resources: pulumi.StringArray{
example.Arn.ApplyT(func(arn string) (string, error) {
return fmt.Sprintf("%v:*:*", arn), nil
}).(pulumi.StringOutput),
},
Principals: iam.GetPolicyDocumentStatementPrincipalArray{
&iam.GetPolicyDocumentStatementPrincipalArgs{
Type: pulumi.String("Service"),
Identifiers: pulumi.StringArray{
pulumi.String("events.amazonaws.com"),
pulumi.String("delivery.logs.amazonaws.com"),
},
},
},
Conditions: iam.GetPolicyDocumentStatementConditionArray{
&iam.GetPolicyDocumentStatementConditionArgs{
Test: pulumi.String("ArnEquals"),
Values: pulumi.StringArray{
exampleEventRule.Arn,
},
Variable: pulumi.String("aws:SourceArn"),
},
},
},
},
}, nil)
_, err = cloudwatch.NewLogResourcePolicy(ctx, "example", &cloudwatch.LogResourcePolicyArgs{
PolicyDocument: pulumi.String(exampleLogPolicy.ApplyT(func(exampleLogPolicy iam.GetPolicyDocumentResult) (*string, error) {
return &exampleLogPolicy.Json, nil
}).(pulumi.StringPtrOutput)),
PolicyName: pulumi.String("guardduty-log-publishing-policy"),
})
if err != nil {
return err
}
_, err = cloudwatch.NewEventTarget(ctx, "example", &cloudwatch.EventTargetArgs{
Rule: exampleEventRule.Name,
Arn: example.Arn,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.CloudWatch.LogGroup("example", new()
{
Name = "/aws/events/guardduty/logs",
RetentionInDays = 1,
});
var exampleEventRule = new Aws.CloudWatch.EventRule("example", new()
{
Name = "guard-duty_event_rule",
Description = "GuardDuty Findings",
EventPattern = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["source"] = new[]
{
"aws.guardduty",
},
}),
Tags =
{
{ "Environment", "example" },
},
});
var exampleLogPolicy = Aws.Iam.GetPolicyDocument.Invoke(new()
{
Statements = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Effect = "Allow",
Actions = new[]
{
"logs:CreateLogStream",
},
Resources = new[]
{
$"{example.Arn}:*",
},
Principals = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
{
Type = "Service",
Identifiers = new[]
{
"events.amazonaws.com",
"delivery.logs.amazonaws.com",
},
},
},
},
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Effect = "Allow",
Actions = new[]
{
"logs:PutLogEvents",
},
Resources = new[]
{
$"{example.Arn}:*:*",
},
Principals = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
{
Type = "Service",
Identifiers = new[]
{
"events.amazonaws.com",
"delivery.logs.amazonaws.com",
},
},
},
Conditions = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementConditionInputArgs
{
Test = "ArnEquals",
Values = new[]
{
exampleEventRule.Arn,
},
Variable = "aws:SourceArn",
},
},
},
},
});
var exampleLogResourcePolicy = new Aws.CloudWatch.LogResourcePolicy("example", new()
{
PolicyDocument = exampleLogPolicy.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
PolicyName = "guardduty-log-publishing-policy",
});
var exampleEventTarget = new Aws.CloudWatch.EventTarget("example", new()
{
Rule = exampleEventRule.Name,
Arn = example.Arn,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudwatch.LogGroup;
import com.pulumi.aws.cloudwatch.LogGroupArgs;
import com.pulumi.aws.cloudwatch.EventRule;
import com.pulumi.aws.cloudwatch.EventRuleArgs;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.cloudwatch.LogResourcePolicy;
import com.pulumi.aws.cloudwatch.LogResourcePolicyArgs;
import com.pulumi.aws.cloudwatch.EventTarget;
import com.pulumi.aws.cloudwatch.EventTargetArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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 example = new LogGroup("example", LogGroupArgs.builder()
.name("/aws/events/guardduty/logs")
.retentionInDays(1)
.build());
var exampleEventRule = new EventRule("exampleEventRule", EventRuleArgs.builder()
.name("guard-duty_event_rule")
.description("GuardDuty Findings")
.eventPattern(serializeJson(
jsonObject(
jsonProperty("source", jsonArray("aws.guardduty"))
)))
.tags(Map.of("Environment", "example"))
.build());
final var exampleLogPolicy = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(
GetPolicyDocumentStatementArgs.builder()
.effect("Allow")
.actions("logs:CreateLogStream")
.resources(example.arn().applyValue(arn -> String.format("%s:*", arn)))
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("Service")
.identifiers(
"events.amazonaws.com",
"delivery.logs.amazonaws.com")
.build())
.build(),
GetPolicyDocumentStatementArgs.builder()
.effect("Allow")
.actions("logs:PutLogEvents")
.resources(example.arn().applyValue(arn -> String.format("%s:*:*", arn)))
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("Service")
.identifiers(
"events.amazonaws.com",
"delivery.logs.amazonaws.com")
.build())
.conditions(GetPolicyDocumentStatementConditionArgs.builder()
.test("ArnEquals")
.values(exampleEventRule.arn())
.variable("aws:SourceArn")
.build())
.build())
.build());
var exampleLogResourcePolicy = new LogResourcePolicy("exampleLogResourcePolicy", LogResourcePolicyArgs.builder()
.policyDocument(exampleLogPolicy.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult).applyValue(exampleLogPolicy -> exampleLogPolicy.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json())))
.policyName("guardduty-log-publishing-policy")
.build());
var exampleEventTarget = new EventTarget("exampleEventTarget", EventTargetArgs.builder()
.rule(exampleEventRule.name())
.arn(example.arn())
.build());
}
}
resources:
example:
type: aws:cloudwatch:LogGroup
properties:
name: /aws/events/guardduty/logs
retentionInDays: 1
exampleLogResourcePolicy:
type: aws:cloudwatch:LogResourcePolicy
name: example
properties:
policyDocument: ${exampleLogPolicy.json}
policyName: guardduty-log-publishing-policy
exampleEventRule:
type: aws:cloudwatch:EventRule
name: example
properties:
name: guard-duty_event_rule
description: GuardDuty Findings
eventPattern:
fn::toJSON:
source:
- aws.guardduty
tags:
Environment: example
exampleEventTarget:
type: aws:cloudwatch:EventTarget
name: example
properties:
rule: ${exampleEventRule.name}
arn: ${example.arn}
variables:
exampleLogPolicy:
fn::invoke:
Function: aws:iam:getPolicyDocument
Arguments:
statements:
- effect: Allow
actions:
- logs:CreateLogStream
resources:
- ${example.arn}:*
principals:
- type: Service
identifiers:
- events.amazonaws.com
- delivery.logs.amazonaws.com
- effect: Allow
actions:
- logs:PutLogEvents
resources:
- ${example.arn}:*:*
principals:
- type: Service
identifiers:
- events.amazonaws.com
- delivery.logs.amazonaws.com
conditions:
- test: ArnEquals
values:
- ${exampleEventRule.arn}
variable: aws:SourceArn
AppSync Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as std from "@pulumi/std";
const invokeAppsyncMutation = new aws.cloudwatch.EventRule("invoke_appsync_mutation", {
name: "invoke-appsync-mutation",
description: "schedule_batch_test",
scheduleExpression: "rate(5 minutes)",
});
const appsyncMutationRoleTrust = aws.iam.getPolicyDocument({
statements: [{
actions: ["sts:AssumeRole"],
principals: [{
type: "Service",
identifiers: ["events.amazonaws.com"],
}],
}],
});
const appsyncMutationRole = new aws.iam.Role("appsync_mutation_role", {
name: "appsync-mutation-role",
assumeRolePolicy: appsyncMutationRoleTrust.then(appsyncMutationRoleTrust => appsyncMutationRoleTrust.json),
});
const graphql_api = new aws.appsync.GraphQLApi("graphql-api", {
name: "api",
authenticationType: "AWS_IAM",
schema: ` schema {
mutation: Mutation
query: Query
}
type Query {
testQuery: String
}
type Mutation {
testMutation(input: MutationInput!): TestMutationResult
}
type TestMutationResult {
test: String
}
input MutationInput {
testInput: String
}
`,
});
const invokeAppsyncMutationEventTarget = new aws.cloudwatch.EventTarget("invoke_appsync_mutation", {
arn: std.replaceOutput({
text: graphql_api.arn,
search: "apis",
replace: "endpoints/graphql-api",
}).apply(invoke => invoke.result),
rule: invokeAppsyncMutation.id,
roleArn: appsyncMutationRole.arn,
inputTransformer: {
inputPaths: {
input: "$.detail.input",
},
inputTemplate: ` {
"input": <input>
}
`,
},
appsyncTarget: {
graphqlOperation: "mutation TestMutation($input:MutationInput!){testMutation(input: $input) {test}}",
},
});
const appsyncMutationRolePolicyDocument = aws.iam.getPolicyDocumentOutput({
statements: [{
actions: ["appsync:GraphQL"],
effect: "Allow",
resources: [graphql_api.arn],
}],
});
const appsyncMutationRolePolicy = new aws.iam.Policy("appsync_mutation_role_policy", {
name: "appsync-mutation-role-policy",
policy: appsyncMutationRolePolicyDocument.apply(appsyncMutationRolePolicyDocument => appsyncMutationRolePolicyDocument.json),
});
const appsyncMutationRoleAttachment = new aws.iam.RolePolicyAttachment("appsync_mutation_role_attachment", {
policyArn: appsyncMutationRolePolicy.arn,
role: appsyncMutationRole.name,
});
import pulumi
import pulumi_aws as aws
import pulumi_std as std
invoke_appsync_mutation = aws.cloudwatch.EventRule("invoke_appsync_mutation",
name="invoke-appsync-mutation",
description="schedule_batch_test",
schedule_expression="rate(5 minutes)")
appsync_mutation_role_trust = aws.iam.get_policy_document(statements=[{
"actions": ["sts:AssumeRole"],
"principals": [{
"type": "Service",
"identifiers": ["events.amazonaws.com"],
}],
}])
appsync_mutation_role = aws.iam.Role("appsync_mutation_role",
name="appsync-mutation-role",
assume_role_policy=appsync_mutation_role_trust.json)
graphql_api = aws.appsync.GraphQLApi("graphql-api",
name="api",
authentication_type="AWS_IAM",
schema=""" schema {
mutation: Mutation
query: Query
}
type Query {
testQuery: String
}
type Mutation {
testMutation(input: MutationInput!): TestMutationResult
}
type TestMutationResult {
test: String
}
input MutationInput {
testInput: String
}
""")
invoke_appsync_mutation_event_target = aws.cloudwatch.EventTarget("invoke_appsync_mutation",
arn=std.replace_output(text=graphql_api.arn,
search="apis",
replace="endpoints/graphql-api").apply(lambda invoke: invoke.result),
rule=invoke_appsync_mutation.id,
role_arn=appsync_mutation_role.arn,
input_transformer={
"input_paths": {
"input": "$.detail.input",
},
"input_template": """ {
"input": <input>
}
""",
},
appsync_target={
"graphql_operation": "mutation TestMutation($input:MutationInput!){testMutation(input: $input) {test}}",
})
appsync_mutation_role_policy_document = aws.iam.get_policy_document_output(statements=[{
"actions": ["appsync:GraphQL"],
"effect": "Allow",
"resources": [graphql_api.arn],
}])
appsync_mutation_role_policy = aws.iam.Policy("appsync_mutation_role_policy",
name="appsync-mutation-role-policy",
policy=appsync_mutation_role_policy_document.json)
appsync_mutation_role_attachment = aws.iam.RolePolicyAttachment("appsync_mutation_role_attachment",
policy_arn=appsync_mutation_role_policy.arn,
role=appsync_mutation_role.name)
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/appsync"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
"github.com/pulumi/pulumi-std/sdk/go/std"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
invokeAppsyncMutation, err := cloudwatch.NewEventRule(ctx, "invoke_appsync_mutation", &cloudwatch.EventRuleArgs{
Name: pulumi.String("invoke-appsync-mutation"),
Description: pulumi.String("schedule_batch_test"),
ScheduleExpression: pulumi.String("rate(5 minutes)"),
})
if err != nil {
return err
}
appsyncMutationRoleTrust, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
Statements: []iam.GetPolicyDocumentStatement{
{
Actions: []string{
"sts:AssumeRole",
},
Principals: []iam.GetPolicyDocumentStatementPrincipal{
{
Type: "Service",
Identifiers: []string{
"events.amazonaws.com",
},
},
},
},
},
}, nil)
if err != nil {
return err
}
appsyncMutationRole, err := iam.NewRole(ctx, "appsync_mutation_role", &iam.RoleArgs{
Name: pulumi.String("appsync-mutation-role"),
AssumeRolePolicy: pulumi.String(appsyncMutationRoleTrust.Json),
})
if err != nil {
return err
}
_, err = appsync.NewGraphQLApi(ctx, "graphql-api", &appsync.GraphQLApiArgs{
Name: pulumi.String("api"),
AuthenticationType: pulumi.String("AWS_IAM"),
Schema: pulumi.String(` schema {
mutation: Mutation
query: Query
}
type Query {
testQuery: String
}
type Mutation {
testMutation(input: MutationInput!): TestMutationResult
}
type TestMutationResult {
test: String
}
input MutationInput {
testInput: String
}
`),
})
if err != nil {
return err
}
_, err = cloudwatch.NewEventTarget(ctx, "invoke_appsync_mutation", &cloudwatch.EventTargetArgs{
Arn: pulumi.String(std.ReplaceOutput(ctx, std.ReplaceOutputArgs{
Text: graphql_api.Arn,
Search: pulumi.String("apis"),
Replace: pulumi.String("endpoints/graphql-api"),
}, nil).ApplyT(func(invoke std.ReplaceResult) (*string, error) {
return invoke.Result, nil
}).(pulumi.StringPtrOutput)),
Rule: invokeAppsyncMutation.ID(),
RoleArn: appsyncMutationRole.Arn,
InputTransformer: &cloudwatch.EventTargetInputTransformerArgs{
InputPaths: pulumi.StringMap{
"input": pulumi.String("$.detail.input"),
},
InputTemplate: pulumi.String(" {\n \"input\": <input>\n }\n"),
},
AppsyncTarget: &cloudwatch.EventTargetAppsyncTargetArgs{
GraphqlOperation: pulumi.String("mutation TestMutation($input:MutationInput!){testMutation(input: $input) {test}}"),
},
})
if err != nil {
return err
}
appsyncMutationRolePolicyDocument := iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{
Statements: iam.GetPolicyDocumentStatementArray{
&iam.GetPolicyDocumentStatementArgs{
Actions: pulumi.StringArray{
pulumi.String("appsync:GraphQL"),
},
Effect: pulumi.String("Allow"),
Resources: pulumi.StringArray{
graphql_api.Arn,
},
},
},
}, nil)
appsyncMutationRolePolicy, err := iam.NewPolicy(ctx, "appsync_mutation_role_policy", &iam.PolicyArgs{
Name: pulumi.String("appsync-mutation-role-policy"),
Policy: pulumi.String(appsyncMutationRolePolicyDocument.ApplyT(func(appsyncMutationRolePolicyDocument iam.GetPolicyDocumentResult) (*string, error) {
return &appsyncMutationRolePolicyDocument.Json, nil
}).(pulumi.StringPtrOutput)),
})
if err != nil {
return err
}
_, err = iam.NewRolePolicyAttachment(ctx, "appsync_mutation_role_attachment", &iam.RolePolicyAttachmentArgs{
PolicyArn: appsyncMutationRolePolicy.Arn,
Role: appsyncMutationRole.Name,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
using Std = Pulumi.Std;
return await Deployment.RunAsync(() =>
{
var invokeAppsyncMutation = new Aws.CloudWatch.EventRule("invoke_appsync_mutation", new()
{
Name = "invoke-appsync-mutation",
Description = "schedule_batch_test",
ScheduleExpression = "rate(5 minutes)",
});
var appsyncMutationRoleTrust = Aws.Iam.GetPolicyDocument.Invoke(new()
{
Statements = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Actions = new[]
{
"sts:AssumeRole",
},
Principals = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
{
Type = "Service",
Identifiers = new[]
{
"events.amazonaws.com",
},
},
},
},
},
});
var appsyncMutationRole = new Aws.Iam.Role("appsync_mutation_role", new()
{
Name = "appsync-mutation-role",
AssumeRolePolicy = appsyncMutationRoleTrust.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
});
var graphql_api = new Aws.AppSync.GraphQLApi("graphql-api", new()
{
Name = "api",
AuthenticationType = "AWS_IAM",
Schema = @" schema {
mutation: Mutation
query: Query
}
type Query {
testQuery: String
}
type Mutation {
testMutation(input: MutationInput!): TestMutationResult
}
type TestMutationResult {
test: String
}
input MutationInput {
testInput: String
}
",
});
var invokeAppsyncMutationEventTarget = new Aws.CloudWatch.EventTarget("invoke_appsync_mutation", new()
{
Arn = Std.Replace.Invoke(new()
{
Text = graphql_api.Arn,
Search = "apis",
Replace = "endpoints/graphql-api",
}).Apply(invoke => invoke.Result),
Rule = invokeAppsyncMutation.Id,
RoleArn = appsyncMutationRole.Arn,
InputTransformer = new Aws.CloudWatch.Inputs.EventTargetInputTransformerArgs
{
InputPaths =
{
{ "input", "$.detail.input" },
},
InputTemplate = @" {
""input"": <input>
}
",
},
AppsyncTarget = new Aws.CloudWatch.Inputs.EventTargetAppsyncTargetArgs
{
GraphqlOperation = "mutation TestMutation($input:MutationInput!){testMutation(input: $input) {test}}",
},
});
var appsyncMutationRolePolicyDocument = Aws.Iam.GetPolicyDocument.Invoke(new()
{
Statements = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Actions = new[]
{
"appsync:GraphQL",
},
Effect = "Allow",
Resources = new[]
{
graphql_api.Arn,
},
},
},
});
var appsyncMutationRolePolicy = new Aws.Iam.Policy("appsync_mutation_role_policy", new()
{
Name = "appsync-mutation-role-policy",
PolicyDocument = appsyncMutationRolePolicyDocument.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
});
var appsyncMutationRoleAttachment = new Aws.Iam.RolePolicyAttachment("appsync_mutation_role_attachment", new()
{
PolicyArn = appsyncMutationRolePolicy.Arn,
Role = appsyncMutationRole.Name,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudwatch.EventRule;
import com.pulumi.aws.cloudwatch.EventRuleArgs;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.appsync.GraphQLApi;
import com.pulumi.aws.appsync.GraphQLApiArgs;
import com.pulumi.aws.cloudwatch.EventTarget;
import com.pulumi.aws.cloudwatch.EventTargetArgs;
import com.pulumi.aws.cloudwatch.inputs.EventTargetInputTransformerArgs;
import com.pulumi.aws.cloudwatch.inputs.EventTargetAppsyncTargetArgs;
import com.pulumi.aws.iam.Policy;
import com.pulumi.aws.iam.PolicyArgs;
import com.pulumi.aws.iam.RolePolicyAttachment;
import com.pulumi.aws.iam.RolePolicyAttachmentArgs;
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 invokeAppsyncMutation = new EventRule("invokeAppsyncMutation", EventRuleArgs.builder()
.name("invoke-appsync-mutation")
.description("schedule_batch_test")
.scheduleExpression("rate(5 minutes)")
.build());
final var appsyncMutationRoleTrust = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.actions("sts:AssumeRole")
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("Service")
.identifiers("events.amazonaws.com")
.build())
.build())
.build());
var appsyncMutationRole = new Role("appsyncMutationRole", RoleArgs.builder()
.name("appsync-mutation-role")
.assumeRolePolicy(appsyncMutationRoleTrust.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
.build());
var graphql_api = new GraphQLApi("graphql-api", GraphQLApiArgs.builder()
.name("api")
.authenticationType("AWS_IAM")
.schema("""
schema {
mutation: Mutation
query: Query
}
type Query {
testQuery: String
}
type Mutation {
testMutation(input: MutationInput!): TestMutationResult
}
type TestMutationResult {
test: String
}
input MutationInput {
testInput: String
}
""")
.build());
var invokeAppsyncMutationEventTarget = new EventTarget("invokeAppsyncMutationEventTarget", EventTargetArgs.builder()
.arn(StdFunctions.replace().applyValue(invoke -> invoke.result()))
.rule(invokeAppsyncMutation.id())
.roleArn(appsyncMutationRole.arn())
.inputTransformer(EventTargetInputTransformerArgs.builder()
.inputPaths(Map.of("input", "$.detail.input"))
.inputTemplate("""
{
"input": <input>
}
""")
.build())
.appsyncTarget(EventTargetAppsyncTargetArgs.builder()
.graphqlOperation("mutation TestMutation($input:MutationInput!){testMutation(input: $input) {test}}")
.build())
.build());
final var appsyncMutationRolePolicyDocument = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.actions("appsync:GraphQL")
.effect("Allow")
.resources(graphql_api.arn())
.build())
.build());
var appsyncMutationRolePolicy = new Policy("appsyncMutationRolePolicy", PolicyArgs.builder()
.name("appsync-mutation-role-policy")
.policy(appsyncMutationRolePolicyDocument.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult).applyValue(appsyncMutationRolePolicyDocument -> appsyncMutationRolePolicyDocument.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json())))
.build());
var appsyncMutationRoleAttachment = new RolePolicyAttachment("appsyncMutationRoleAttachment", RolePolicyAttachmentArgs.builder()
.policyArn(appsyncMutationRolePolicy.arn())
.role(appsyncMutationRole.name())
.build());
}
}
resources:
invokeAppsyncMutation:
type: aws:cloudwatch:EventRule
name: invoke_appsync_mutation
properties:
name: invoke-appsync-mutation
description: schedule_batch_test
scheduleExpression: rate(5 minutes)
invokeAppsyncMutationEventTarget:
type: aws:cloudwatch:EventTarget
name: invoke_appsync_mutation
properties:
arn:
fn::invoke:
Function: std:replace
Arguments:
text: ${["graphql-api"].arn}
search: apis
replace: endpoints/graphql-api
Return: result
rule: ${invokeAppsyncMutation.id}
roleArn: ${appsyncMutationRole.arn}
inputTransformer:
inputPaths:
input: $.detail.input
inputTemplate: |2
{
"input": <input>
}
appsyncTarget:
graphqlOperation: 'mutation TestMutation($input:MutationInput!){testMutation(input: $input) {test}}'
appsyncMutationRole:
type: aws:iam:Role
name: appsync_mutation_role
properties:
name: appsync-mutation-role
assumeRolePolicy: ${appsyncMutationRoleTrust.json}
appsyncMutationRolePolicy:
type: aws:iam:Policy
name: appsync_mutation_role_policy
properties:
name: appsync-mutation-role-policy
policy: ${appsyncMutationRolePolicyDocument.json}
appsyncMutationRoleAttachment:
type: aws:iam:RolePolicyAttachment
name: appsync_mutation_role_attachment
properties:
policyArn: ${appsyncMutationRolePolicy.arn}
role: ${appsyncMutationRole.name}
graphql-api:
type: aws:appsync:GraphQLApi
properties:
name: api
authenticationType: AWS_IAM
schema: |2
schema {
mutation: Mutation
query: Query
}
type Query {
testQuery: String
}
type Mutation {
testMutation(input: MutationInput!): TestMutationResult
}
type TestMutationResult {
test: String
}
input MutationInput {
testInput: String
}
variables:
appsyncMutationRoleTrust:
fn::invoke:
Function: aws:iam:getPolicyDocument
Arguments:
statements:
- actions:
- sts:AssumeRole
principals:
- type: Service
identifiers:
- events.amazonaws.com
appsyncMutationRolePolicyDocument:
fn::invoke:
Function: aws:iam:getPolicyDocument
Arguments:
statements:
- actions:
- appsync:GraphQL
effect: Allow
resources:
- ${["graphql-api"].arn}
Create EventTarget Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new EventTarget(name: string, args: EventTargetArgs, opts?: CustomResourceOptions);
@overload
def EventTarget(resource_name: str,
args: EventTargetArgs,
opts: Optional[ResourceOptions] = None)
@overload
def EventTarget(resource_name: str,
opts: Optional[ResourceOptions] = None,
rule: Optional[str] = None,
arn: Optional[str] = None,
event_bus_name: Optional[str] = None,
kinesis_target: Optional[EventTargetKinesisTargetArgs] = None,
ecs_target: Optional[EventTargetEcsTargetArgs] = None,
appsync_target: Optional[EventTargetAppsyncTargetArgs] = None,
force_destroy: Optional[bool] = None,
http_target: Optional[EventTargetHttpTargetArgs] = None,
input: Optional[str] = None,
input_path: Optional[str] = None,
input_transformer: Optional[EventTargetInputTransformerArgs] = None,
dead_letter_config: Optional[EventTargetDeadLetterConfigArgs] = None,
redshift_target: Optional[EventTargetRedshiftTargetArgs] = None,
retry_policy: Optional[EventTargetRetryPolicyArgs] = None,
role_arn: Optional[str] = None,
batch_target: Optional[EventTargetBatchTargetArgs] = None,
run_command_targets: Optional[Sequence[EventTargetRunCommandTargetArgs]] = None,
sagemaker_pipeline_target: Optional[EventTargetSagemakerPipelineTargetArgs] = None,
sqs_target: Optional[EventTargetSqsTargetArgs] = None,
target_id: Optional[str] = None)
func NewEventTarget(ctx *Context, name string, args EventTargetArgs, opts ...ResourceOption) (*EventTarget, error)
public EventTarget(string name, EventTargetArgs args, CustomResourceOptions? opts = null)
public EventTarget(String name, EventTargetArgs args)
public EventTarget(String name, EventTargetArgs args, CustomResourceOptions options)
type: aws:cloudwatch:EventTarget
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args EventTargetArgs
- 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 EventTargetArgs
- 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 EventTargetArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args EventTargetArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args EventTargetArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var eventTargetResource = new Aws.CloudWatch.EventTarget("eventTargetResource", new()
{
Rule = "string",
Arn = "string",
EventBusName = "string",
KinesisTarget = new Aws.CloudWatch.Inputs.EventTargetKinesisTargetArgs
{
PartitionKeyPath = "string",
},
EcsTarget = new Aws.CloudWatch.Inputs.EventTargetEcsTargetArgs
{
TaskDefinitionArn = "string",
OrderedPlacementStrategies = new[]
{
new Aws.CloudWatch.Inputs.EventTargetEcsTargetOrderedPlacementStrategyArgs
{
Type = "string",
Field = "string",
},
},
EnableExecuteCommand = false,
Group = "string",
LaunchType = "string",
NetworkConfiguration = new Aws.CloudWatch.Inputs.EventTargetEcsTargetNetworkConfigurationArgs
{
Subnets = new[]
{
"string",
},
AssignPublicIp = false,
SecurityGroups = new[]
{
"string",
},
},
CapacityProviderStrategies = new[]
{
new Aws.CloudWatch.Inputs.EventTargetEcsTargetCapacityProviderStrategyArgs
{
CapacityProvider = "string",
Base = 0,
Weight = 0,
},
},
PlacementConstraints = new[]
{
new Aws.CloudWatch.Inputs.EventTargetEcsTargetPlacementConstraintArgs
{
Type = "string",
Expression = "string",
},
},
PlatformVersion = "string",
PropagateTags = "string",
Tags =
{
{ "string", "string" },
},
TaskCount = 0,
EnableEcsManagedTags = false,
},
AppsyncTarget = new Aws.CloudWatch.Inputs.EventTargetAppsyncTargetArgs
{
GraphqlOperation = "string",
},
ForceDestroy = false,
HttpTarget = new Aws.CloudWatch.Inputs.EventTargetHttpTargetArgs
{
HeaderParameters =
{
{ "string", "string" },
},
PathParameterValues = new[]
{
"string",
},
QueryStringParameters =
{
{ "string", "string" },
},
},
Input = "string",
InputPath = "string",
InputTransformer = new Aws.CloudWatch.Inputs.EventTargetInputTransformerArgs
{
InputTemplate = "string",
InputPaths =
{
{ "string", "string" },
},
},
DeadLetterConfig = new Aws.CloudWatch.Inputs.EventTargetDeadLetterConfigArgs
{
Arn = "string",
},
RedshiftTarget = new Aws.CloudWatch.Inputs.EventTargetRedshiftTargetArgs
{
Database = "string",
DbUser = "string",
SecretsManagerArn = "string",
Sql = "string",
StatementName = "string",
WithEvent = false,
},
RetryPolicy = new Aws.CloudWatch.Inputs.EventTargetRetryPolicyArgs
{
MaximumEventAgeInSeconds = 0,
MaximumRetryAttempts = 0,
},
RoleArn = "string",
BatchTarget = new Aws.CloudWatch.Inputs.EventTargetBatchTargetArgs
{
JobDefinition = "string",
JobName = "string",
ArraySize = 0,
JobAttempts = 0,
},
RunCommandTargets = new[]
{
new Aws.CloudWatch.Inputs.EventTargetRunCommandTargetArgs
{
Key = "string",
Values = new[]
{
"string",
},
},
},
SagemakerPipelineTarget = new Aws.CloudWatch.Inputs.EventTargetSagemakerPipelineTargetArgs
{
PipelineParameterLists = new[]
{
new Aws.CloudWatch.Inputs.EventTargetSagemakerPipelineTargetPipelineParameterListArgs
{
Name = "string",
Value = "string",
},
},
},
SqsTarget = new Aws.CloudWatch.Inputs.EventTargetSqsTargetArgs
{
MessageGroupId = "string",
},
TargetId = "string",
});
example, err := cloudwatch.NewEventTarget(ctx, "eventTargetResource", &cloudwatch.EventTargetArgs{
Rule: pulumi.String("string"),
Arn: pulumi.String("string"),
EventBusName: pulumi.String("string"),
KinesisTarget: &cloudwatch.EventTargetKinesisTargetArgs{
PartitionKeyPath: pulumi.String("string"),
},
EcsTarget: &cloudwatch.EventTargetEcsTargetArgs{
TaskDefinitionArn: pulumi.String("string"),
OrderedPlacementStrategies: cloudwatch.EventTargetEcsTargetOrderedPlacementStrategyArray{
&cloudwatch.EventTargetEcsTargetOrderedPlacementStrategyArgs{
Type: pulumi.String("string"),
Field: pulumi.String("string"),
},
},
EnableExecuteCommand: pulumi.Bool(false),
Group: pulumi.String("string"),
LaunchType: pulumi.String("string"),
NetworkConfiguration: &cloudwatch.EventTargetEcsTargetNetworkConfigurationArgs{
Subnets: pulumi.StringArray{
pulumi.String("string"),
},
AssignPublicIp: pulumi.Bool(false),
SecurityGroups: pulumi.StringArray{
pulumi.String("string"),
},
},
CapacityProviderStrategies: cloudwatch.EventTargetEcsTargetCapacityProviderStrategyArray{
&cloudwatch.EventTargetEcsTargetCapacityProviderStrategyArgs{
CapacityProvider: pulumi.String("string"),
Base: pulumi.Int(0),
Weight: pulumi.Int(0),
},
},
PlacementConstraints: cloudwatch.EventTargetEcsTargetPlacementConstraintArray{
&cloudwatch.EventTargetEcsTargetPlacementConstraintArgs{
Type: pulumi.String("string"),
Expression: pulumi.String("string"),
},
},
PlatformVersion: pulumi.String("string"),
PropagateTags: pulumi.String("string"),
Tags: pulumi.StringMap{
"string": pulumi.String("string"),
},
TaskCount: pulumi.Int(0),
EnableEcsManagedTags: pulumi.Bool(false),
},
AppsyncTarget: &cloudwatch.EventTargetAppsyncTargetArgs{
GraphqlOperation: pulumi.String("string"),
},
ForceDestroy: pulumi.Bool(false),
HttpTarget: &cloudwatch.EventTargetHttpTargetArgs{
HeaderParameters: pulumi.StringMap{
"string": pulumi.String("string"),
},
PathParameterValues: pulumi.StringArray{
pulumi.String("string"),
},
QueryStringParameters: pulumi.StringMap{
"string": pulumi.String("string"),
},
},
Input: pulumi.String("string"),
InputPath: pulumi.String("string"),
InputTransformer: &cloudwatch.EventTargetInputTransformerArgs{
InputTemplate: pulumi.String("string"),
InputPaths: pulumi.StringMap{
"string": pulumi.String("string"),
},
},
DeadLetterConfig: &cloudwatch.EventTargetDeadLetterConfigArgs{
Arn: pulumi.String("string"),
},
RedshiftTarget: &cloudwatch.EventTargetRedshiftTargetArgs{
Database: pulumi.String("string"),
DbUser: pulumi.String("string"),
SecretsManagerArn: pulumi.String("string"),
Sql: pulumi.String("string"),
StatementName: pulumi.String("string"),
WithEvent: pulumi.Bool(false),
},
RetryPolicy: &cloudwatch.EventTargetRetryPolicyArgs{
MaximumEventAgeInSeconds: pulumi.Int(0),
MaximumRetryAttempts: pulumi.Int(0),
},
RoleArn: pulumi.String("string"),
BatchTarget: &cloudwatch.EventTargetBatchTargetArgs{
JobDefinition: pulumi.String("string"),
JobName: pulumi.String("string"),
ArraySize: pulumi.Int(0),
JobAttempts: pulumi.Int(0),
},
RunCommandTargets: cloudwatch.EventTargetRunCommandTargetArray{
&cloudwatch.EventTargetRunCommandTargetArgs{
Key: pulumi.String("string"),
Values: pulumi.StringArray{
pulumi.String("string"),
},
},
},
SagemakerPipelineTarget: &cloudwatch.EventTargetSagemakerPipelineTargetArgs{
PipelineParameterLists: cloudwatch.EventTargetSagemakerPipelineTargetPipelineParameterListArray{
&cloudwatch.EventTargetSagemakerPipelineTargetPipelineParameterListArgs{
Name: pulumi.String("string"),
Value: pulumi.String("string"),
},
},
},
SqsTarget: &cloudwatch.EventTargetSqsTargetArgs{
MessageGroupId: pulumi.String("string"),
},
TargetId: pulumi.String("string"),
})
var eventTargetResource = new EventTarget("eventTargetResource", EventTargetArgs.builder()
.rule("string")
.arn("string")
.eventBusName("string")
.kinesisTarget(EventTargetKinesisTargetArgs.builder()
.partitionKeyPath("string")
.build())
.ecsTarget(EventTargetEcsTargetArgs.builder()
.taskDefinitionArn("string")
.orderedPlacementStrategies(EventTargetEcsTargetOrderedPlacementStrategyArgs.builder()
.type("string")
.field("string")
.build())
.enableExecuteCommand(false)
.group("string")
.launchType("string")
.networkConfiguration(EventTargetEcsTargetNetworkConfigurationArgs.builder()
.subnets("string")
.assignPublicIp(false)
.securityGroups("string")
.build())
.capacityProviderStrategies(EventTargetEcsTargetCapacityProviderStrategyArgs.builder()
.capacityProvider("string")
.base(0)
.weight(0)
.build())
.placementConstraints(EventTargetEcsTargetPlacementConstraintArgs.builder()
.type("string")
.expression("string")
.build())
.platformVersion("string")
.propagateTags("string")
.tags(Map.of("string", "string"))
.taskCount(0)
.enableEcsManagedTags(false)
.build())
.appsyncTarget(EventTargetAppsyncTargetArgs.builder()
.graphqlOperation("string")
.build())
.forceDestroy(false)
.httpTarget(EventTargetHttpTargetArgs.builder()
.headerParameters(Map.of("string", "string"))
.pathParameterValues("string")
.queryStringParameters(Map.of("string", "string"))
.build())
.input("string")
.inputPath("string")
.inputTransformer(EventTargetInputTransformerArgs.builder()
.inputTemplate("string")
.inputPaths(Map.of("string", "string"))
.build())
.deadLetterConfig(EventTargetDeadLetterConfigArgs.builder()
.arn("string")
.build())
.redshiftTarget(EventTargetRedshiftTargetArgs.builder()
.database("string")
.dbUser("string")
.secretsManagerArn("string")
.sql("string")
.statementName("string")
.withEvent(false)
.build())
.retryPolicy(EventTargetRetryPolicyArgs.builder()
.maximumEventAgeInSeconds(0)
.maximumRetryAttempts(0)
.build())
.roleArn("string")
.batchTarget(EventTargetBatchTargetArgs.builder()
.jobDefinition("string")
.jobName("string")
.arraySize(0)
.jobAttempts(0)
.build())
.runCommandTargets(EventTargetRunCommandTargetArgs.builder()
.key("string")
.values("string")
.build())
.sagemakerPipelineTarget(EventTargetSagemakerPipelineTargetArgs.builder()
.pipelineParameterLists(EventTargetSagemakerPipelineTargetPipelineParameterListArgs.builder()
.name("string")
.value("string")
.build())
.build())
.sqsTarget(EventTargetSqsTargetArgs.builder()
.messageGroupId("string")
.build())
.targetId("string")
.build());
event_target_resource = aws.cloudwatch.EventTarget("eventTargetResource",
rule="string",
arn="string",
event_bus_name="string",
kinesis_target={
"partition_key_path": "string",
},
ecs_target={
"task_definition_arn": "string",
"ordered_placement_strategies": [{
"type": "string",
"field": "string",
}],
"enable_execute_command": False,
"group": "string",
"launch_type": "string",
"network_configuration": {
"subnets": ["string"],
"assign_public_ip": False,
"security_groups": ["string"],
},
"capacity_provider_strategies": [{
"capacity_provider": "string",
"base": 0,
"weight": 0,
}],
"placement_constraints": [{
"type": "string",
"expression": "string",
}],
"platform_version": "string",
"propagate_tags": "string",
"tags": {
"string": "string",
},
"task_count": 0,
"enable_ecs_managed_tags": False,
},
appsync_target={
"graphql_operation": "string",
},
force_destroy=False,
http_target={
"header_parameters": {
"string": "string",
},
"path_parameter_values": ["string"],
"query_string_parameters": {
"string": "string",
},
},
input="string",
input_path="string",
input_transformer={
"input_template": "string",
"input_paths": {
"string": "string",
},
},
dead_letter_config={
"arn": "string",
},
redshift_target={
"database": "string",
"db_user": "string",
"secrets_manager_arn": "string",
"sql": "string",
"statement_name": "string",
"with_event": False,
},
retry_policy={
"maximum_event_age_in_seconds": 0,
"maximum_retry_attempts": 0,
},
role_arn="string",
batch_target={
"job_definition": "string",
"job_name": "string",
"array_size": 0,
"job_attempts": 0,
},
run_command_targets=[{
"key": "string",
"values": ["string"],
}],
sagemaker_pipeline_target={
"pipeline_parameter_lists": [{
"name": "string",
"value": "string",
}],
},
sqs_target={
"message_group_id": "string",
},
target_id="string")
const eventTargetResource = new aws.cloudwatch.EventTarget("eventTargetResource", {
rule: "string",
arn: "string",
eventBusName: "string",
kinesisTarget: {
partitionKeyPath: "string",
},
ecsTarget: {
taskDefinitionArn: "string",
orderedPlacementStrategies: [{
type: "string",
field: "string",
}],
enableExecuteCommand: false,
group: "string",
launchType: "string",
networkConfiguration: {
subnets: ["string"],
assignPublicIp: false,
securityGroups: ["string"],
},
capacityProviderStrategies: [{
capacityProvider: "string",
base: 0,
weight: 0,
}],
placementConstraints: [{
type: "string",
expression: "string",
}],
platformVersion: "string",
propagateTags: "string",
tags: {
string: "string",
},
taskCount: 0,
enableEcsManagedTags: false,
},
appsyncTarget: {
graphqlOperation: "string",
},
forceDestroy: false,
httpTarget: {
headerParameters: {
string: "string",
},
pathParameterValues: ["string"],
queryStringParameters: {
string: "string",
},
},
input: "string",
inputPath: "string",
inputTransformer: {
inputTemplate: "string",
inputPaths: {
string: "string",
},
},
deadLetterConfig: {
arn: "string",
},
redshiftTarget: {
database: "string",
dbUser: "string",
secretsManagerArn: "string",
sql: "string",
statementName: "string",
withEvent: false,
},
retryPolicy: {
maximumEventAgeInSeconds: 0,
maximumRetryAttempts: 0,
},
roleArn: "string",
batchTarget: {
jobDefinition: "string",
jobName: "string",
arraySize: 0,
jobAttempts: 0,
},
runCommandTargets: [{
key: "string",
values: ["string"],
}],
sagemakerPipelineTarget: {
pipelineParameterLists: [{
name: "string",
value: "string",
}],
},
sqsTarget: {
messageGroupId: "string",
},
targetId: "string",
});
type: aws:cloudwatch:EventTarget
properties:
appsyncTarget:
graphqlOperation: string
arn: string
batchTarget:
arraySize: 0
jobAttempts: 0
jobDefinition: string
jobName: string
deadLetterConfig:
arn: string
ecsTarget:
capacityProviderStrategies:
- base: 0
capacityProvider: string
weight: 0
enableEcsManagedTags: false
enableExecuteCommand: false
group: string
launchType: string
networkConfiguration:
assignPublicIp: false
securityGroups:
- string
subnets:
- string
orderedPlacementStrategies:
- field: string
type: string
placementConstraints:
- expression: string
type: string
platformVersion: string
propagateTags: string
tags:
string: string
taskCount: 0
taskDefinitionArn: string
eventBusName: string
forceDestroy: false
httpTarget:
headerParameters:
string: string
pathParameterValues:
- string
queryStringParameters:
string: string
input: string
inputPath: string
inputTransformer:
inputPaths:
string: string
inputTemplate: string
kinesisTarget:
partitionKeyPath: string
redshiftTarget:
database: string
dbUser: string
secretsManagerArn: string
sql: string
statementName: string
withEvent: false
retryPolicy:
maximumEventAgeInSeconds: 0
maximumRetryAttempts: 0
roleArn: string
rule: string
runCommandTargets:
- key: string
values:
- string
sagemakerPipelineTarget:
pipelineParameterLists:
- name: string
value: string
sqsTarget:
messageGroupId: string
targetId: string
EventTarget Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The EventTarget resource accepts the following input properties:
- Arn string
- The Amazon Resource Name (ARN) of the target.
- Rule string
The name of the rule you want to add targets to.
The following arguments are optional:
- Appsync
Target EventTarget Appsync Target - Parameters used when you are using the rule to invoke an AppSync GraphQL API mutation. Documented below. A maximum of 1 are allowed.
- Batch
Target EventTarget Batch Target - Parameters used when you are using the rule to invoke an Amazon Batch Job. Documented below. A maximum of 1 are allowed.
- Dead
Letter EventConfig Target Dead Letter Config - Parameters used when you are providing a dead letter config. Documented below. A maximum of 1 are allowed.
- Ecs
Target EventTarget Ecs Target - Parameters used when you are using the rule to invoke Amazon ECS Task. Documented below. A maximum of 1 are allowed.
- Event
Bus stringName - The name or ARN of the event bus to associate with the rule.
If you omit this, the
default
event bus is used. - Force
Destroy bool - Used to delete managed rules created by AWS. Defaults to
false
. - Http
Target EventTarget Http Target - Parameters used when you are using the rule to invoke an API Gateway REST endpoint. Documented below. A maximum of 1 is allowed.
- Input string
- Valid JSON text passed to the target. Conflicts with
input_path
andinput_transformer
. - Input
Path string - The value of the JSONPath that is used for extracting part of the matched event when passing it to the target. Conflicts with
input
andinput_transformer
. - Input
Transformer EventTarget Input Transformer - Parameters used when you are providing a custom input to a target based on certain event data. Conflicts with
input
andinput_path
. - Kinesis
Target EventTarget Kinesis Target - Parameters used when you are using the rule to invoke an Amazon Kinesis Stream. Documented below. A maximum of 1 are allowed.
- Redshift
Target EventTarget Redshift Target - Parameters used when you are using the rule to invoke an Amazon Redshift Statement. Documented below. A maximum of 1 are allowed.
- Retry
Policy EventTarget Retry Policy - Parameters used when you are providing retry policies. Documented below. A maximum of 1 are allowed.
- Role
Arn string - The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered. Required if
ecs_target
is used or target inarn
is EC2 instance, Kinesis data stream, Step Functions state machine, or Event Bus in different account or region. - Run
Command List<EventTargets Target Run Command Target> - Parameters used when you are using the rule to invoke Amazon EC2 Run Command. Documented below. A maximum of 5 are allowed.
- Sagemaker
Pipeline EventTarget Target Sagemaker Pipeline Target - Parameters used when you are using the rule to invoke an Amazon SageMaker Pipeline. Documented below. A maximum of 1 are allowed.
- Sqs
Target EventTarget Sqs Target - Parameters used when you are using the rule to invoke an Amazon SQS Queue. Documented below. A maximum of 1 are allowed.
- Target
Id string - The unique target assignment ID. If missing, will generate a random, unique id.
- Arn string
- The Amazon Resource Name (ARN) of the target.
- Rule string
The name of the rule you want to add targets to.
The following arguments are optional:
- Appsync
Target EventTarget Appsync Target Args - Parameters used when you are using the rule to invoke an AppSync GraphQL API mutation. Documented below. A maximum of 1 are allowed.
- Batch
Target EventTarget Batch Target Args - Parameters used when you are using the rule to invoke an Amazon Batch Job. Documented below. A maximum of 1 are allowed.
- Dead
Letter EventConfig Target Dead Letter Config Args - Parameters used when you are providing a dead letter config. Documented below. A maximum of 1 are allowed.
- Ecs
Target EventTarget Ecs Target Args - Parameters used when you are using the rule to invoke Amazon ECS Task. Documented below. A maximum of 1 are allowed.
- Event
Bus stringName - The name or ARN of the event bus to associate with the rule.
If you omit this, the
default
event bus is used. - Force
Destroy bool - Used to delete managed rules created by AWS. Defaults to
false
. - Http
Target EventTarget Http Target Args - Parameters used when you are using the rule to invoke an API Gateway REST endpoint. Documented below. A maximum of 1 is allowed.
- Input string
- Valid JSON text passed to the target. Conflicts with
input_path
andinput_transformer
. - Input
Path string - The value of the JSONPath that is used for extracting part of the matched event when passing it to the target. Conflicts with
input
andinput_transformer
. - Input
Transformer EventTarget Input Transformer Args - Parameters used when you are providing a custom input to a target based on certain event data. Conflicts with
input
andinput_path
. - Kinesis
Target EventTarget Kinesis Target Args - Parameters used when you are using the rule to invoke an Amazon Kinesis Stream. Documented below. A maximum of 1 are allowed.
- Redshift
Target EventTarget Redshift Target Args - Parameters used when you are using the rule to invoke an Amazon Redshift Statement. Documented below. A maximum of 1 are allowed.
- Retry
Policy EventTarget Retry Policy Args - Parameters used when you are providing retry policies. Documented below. A maximum of 1 are allowed.
- Role
Arn string - The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered. Required if
ecs_target
is used or target inarn
is EC2 instance, Kinesis data stream, Step Functions state machine, or Event Bus in different account or region. - Run
Command []EventTargets Target Run Command Target Args - Parameters used when you are using the rule to invoke Amazon EC2 Run Command. Documented below. A maximum of 5 are allowed.
- Sagemaker
Pipeline EventTarget Target Sagemaker Pipeline Target Args - Parameters used when you are using the rule to invoke an Amazon SageMaker Pipeline. Documented below. A maximum of 1 are allowed.
- Sqs
Target EventTarget Sqs Target Args - Parameters used when you are using the rule to invoke an Amazon SQS Queue. Documented below. A maximum of 1 are allowed.
- Target
Id string - The unique target assignment ID. If missing, will generate a random, unique id.
- arn String
- The Amazon Resource Name (ARN) of the target.
- rule String
The name of the rule you want to add targets to.
The following arguments are optional:
- appsync
Target EventTarget Appsync Target - Parameters used when you are using the rule to invoke an AppSync GraphQL API mutation. Documented below. A maximum of 1 are allowed.
- batch
Target EventTarget Batch Target - Parameters used when you are using the rule to invoke an Amazon Batch Job. Documented below. A maximum of 1 are allowed.
- dead
Letter EventConfig Target Dead Letter Config - Parameters used when you are providing a dead letter config. Documented below. A maximum of 1 are allowed.
- ecs
Target EventTarget Ecs Target - Parameters used when you are using the rule to invoke Amazon ECS Task. Documented below. A maximum of 1 are allowed.
- event
Bus StringName - The name or ARN of the event bus to associate with the rule.
If you omit this, the
default
event bus is used. - force
Destroy Boolean - Used to delete managed rules created by AWS. Defaults to
false
. - http
Target EventTarget Http Target - Parameters used when you are using the rule to invoke an API Gateway REST endpoint. Documented below. A maximum of 1 is allowed.
- input String
- Valid JSON text passed to the target. Conflicts with
input_path
andinput_transformer
. - input
Path String - The value of the JSONPath that is used for extracting part of the matched event when passing it to the target. Conflicts with
input
andinput_transformer
. - input
Transformer EventTarget Input Transformer - Parameters used when you are providing a custom input to a target based on certain event data. Conflicts with
input
andinput_path
. - kinesis
Target EventTarget Kinesis Target - Parameters used when you are using the rule to invoke an Amazon Kinesis Stream. Documented below. A maximum of 1 are allowed.
- redshift
Target EventTarget Redshift Target - Parameters used when you are using the rule to invoke an Amazon Redshift Statement. Documented below. A maximum of 1 are allowed.
- retry
Policy EventTarget Retry Policy - Parameters used when you are providing retry policies. Documented below. A maximum of 1 are allowed.
- role
Arn String - The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered. Required if
ecs_target
is used or target inarn
is EC2 instance, Kinesis data stream, Step Functions state machine, or Event Bus in different account or region. - run
Command List<EventTargets Target Run Command Target> - Parameters used when you are using the rule to invoke Amazon EC2 Run Command. Documented below. A maximum of 5 are allowed.
- sagemaker
Pipeline EventTarget Target Sagemaker Pipeline Target - Parameters used when you are using the rule to invoke an Amazon SageMaker Pipeline. Documented below. A maximum of 1 are allowed.
- sqs
Target EventTarget Sqs Target - Parameters used when you are using the rule to invoke an Amazon SQS Queue. Documented below. A maximum of 1 are allowed.
- target
Id String - The unique target assignment ID. If missing, will generate a random, unique id.
- arn string
- The Amazon Resource Name (ARN) of the target.
- rule string
The name of the rule you want to add targets to.
The following arguments are optional:
- appsync
Target EventTarget Appsync Target - Parameters used when you are using the rule to invoke an AppSync GraphQL API mutation. Documented below. A maximum of 1 are allowed.
- batch
Target EventTarget Batch Target - Parameters used when you are using the rule to invoke an Amazon Batch Job. Documented below. A maximum of 1 are allowed.
- dead
Letter EventConfig Target Dead Letter Config - Parameters used when you are providing a dead letter config. Documented below. A maximum of 1 are allowed.
- ecs
Target EventTarget Ecs Target - Parameters used when you are using the rule to invoke Amazon ECS Task. Documented below. A maximum of 1 are allowed.
- event
Bus stringName - The name or ARN of the event bus to associate with the rule.
If you omit this, the
default
event bus is used. - force
Destroy boolean - Used to delete managed rules created by AWS. Defaults to
false
. - http
Target EventTarget Http Target - Parameters used when you are using the rule to invoke an API Gateway REST endpoint. Documented below. A maximum of 1 is allowed.
- input string
- Valid JSON text passed to the target. Conflicts with
input_path
andinput_transformer
. - input
Path string - The value of the JSONPath that is used for extracting part of the matched event when passing it to the target. Conflicts with
input
andinput_transformer
. - input
Transformer EventTarget Input Transformer - Parameters used when you are providing a custom input to a target based on certain event data. Conflicts with
input
andinput_path
. - kinesis
Target EventTarget Kinesis Target - Parameters used when you are using the rule to invoke an Amazon Kinesis Stream. Documented below. A maximum of 1 are allowed.
- redshift
Target EventTarget Redshift Target - Parameters used when you are using the rule to invoke an Amazon Redshift Statement. Documented below. A maximum of 1 are allowed.
- retry
Policy EventTarget Retry Policy - Parameters used when you are providing retry policies. Documented below. A maximum of 1 are allowed.
- role
Arn string - The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered. Required if
ecs_target
is used or target inarn
is EC2 instance, Kinesis data stream, Step Functions state machine, or Event Bus in different account or region. - run
Command EventTargets Target Run Command Target[] - Parameters used when you are using the rule to invoke Amazon EC2 Run Command. Documented below. A maximum of 5 are allowed.
- sagemaker
Pipeline EventTarget Target Sagemaker Pipeline Target - Parameters used when you are using the rule to invoke an Amazon SageMaker Pipeline. Documented below. A maximum of 1 are allowed.
- sqs
Target EventTarget Sqs Target - Parameters used when you are using the rule to invoke an Amazon SQS Queue. Documented below. A maximum of 1 are allowed.
- target
Id string - The unique target assignment ID. If missing, will generate a random, unique id.
- arn str
- The Amazon Resource Name (ARN) of the target.
- rule str
The name of the rule you want to add targets to.
The following arguments are optional:
- appsync_
target EventTarget Appsync Target Args - Parameters used when you are using the rule to invoke an AppSync GraphQL API mutation. Documented below. A maximum of 1 are allowed.
- batch_
target EventTarget Batch Target Args - Parameters used when you are using the rule to invoke an Amazon Batch Job. Documented below. A maximum of 1 are allowed.
- dead_
letter_ Eventconfig Target Dead Letter Config Args - Parameters used when you are providing a dead letter config. Documented below. A maximum of 1 are allowed.
- ecs_
target EventTarget Ecs Target Args - Parameters used when you are using the rule to invoke Amazon ECS Task. Documented below. A maximum of 1 are allowed.
- event_
bus_ strname - The name or ARN of the event bus to associate with the rule.
If you omit this, the
default
event bus is used. - force_
destroy bool - Used to delete managed rules created by AWS. Defaults to
false
. - http_
target EventTarget Http Target Args - Parameters used when you are using the rule to invoke an API Gateway REST endpoint. Documented below. A maximum of 1 is allowed.
- input str
- Valid JSON text passed to the target. Conflicts with
input_path
andinput_transformer
. - input_
path str - The value of the JSONPath that is used for extracting part of the matched event when passing it to the target. Conflicts with
input
andinput_transformer
. - input_
transformer EventTarget Input Transformer Args - Parameters used when you are providing a custom input to a target based on certain event data. Conflicts with
input
andinput_path
. - kinesis_
target EventTarget Kinesis Target Args - Parameters used when you are using the rule to invoke an Amazon Kinesis Stream. Documented below. A maximum of 1 are allowed.
- redshift_
target EventTarget Redshift Target Args - Parameters used when you are using the rule to invoke an Amazon Redshift Statement. Documented below. A maximum of 1 are allowed.
- retry_
policy EventTarget Retry Policy Args - Parameters used when you are providing retry policies. Documented below. A maximum of 1 are allowed.
- role_
arn str - The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered. Required if
ecs_target
is used or target inarn
is EC2 instance, Kinesis data stream, Step Functions state machine, or Event Bus in different account or region. - run_
command_ Sequence[Eventtargets Target Run Command Target Args] - Parameters used when you are using the rule to invoke Amazon EC2 Run Command. Documented below. A maximum of 5 are allowed.
- sagemaker_
pipeline_ Eventtarget Target Sagemaker Pipeline Target Args - Parameters used when you are using the rule to invoke an Amazon SageMaker Pipeline. Documented below. A maximum of 1 are allowed.
- sqs_
target EventTarget Sqs Target Args - Parameters used when you are using the rule to invoke an Amazon SQS Queue. Documented below. A maximum of 1 are allowed.
- target_
id str - The unique target assignment ID. If missing, will generate a random, unique id.
- arn String
- The Amazon Resource Name (ARN) of the target.
- rule String
The name of the rule you want to add targets to.
The following arguments are optional:
- appsync
Target Property Map - Parameters used when you are using the rule to invoke an AppSync GraphQL API mutation. Documented below. A maximum of 1 are allowed.
- batch
Target Property Map - Parameters used when you are using the rule to invoke an Amazon Batch Job. Documented below. A maximum of 1 are allowed.
- dead
Letter Property MapConfig - Parameters used when you are providing a dead letter config. Documented below. A maximum of 1 are allowed.
- ecs
Target Property Map - Parameters used when you are using the rule to invoke Amazon ECS Task. Documented below. A maximum of 1 are allowed.
- event
Bus StringName - The name or ARN of the event bus to associate with the rule.
If you omit this, the
default
event bus is used. - force
Destroy Boolean - Used to delete managed rules created by AWS. Defaults to
false
. - http
Target Property Map - Parameters used when you are using the rule to invoke an API Gateway REST endpoint. Documented below. A maximum of 1 is allowed.
- input String
- Valid JSON text passed to the target. Conflicts with
input_path
andinput_transformer
. - input
Path String - The value of the JSONPath that is used for extracting part of the matched event when passing it to the target. Conflicts with
input
andinput_transformer
. - input
Transformer Property Map - Parameters used when you are providing a custom input to a target based on certain event data. Conflicts with
input
andinput_path
. - kinesis
Target Property Map - Parameters used when you are using the rule to invoke an Amazon Kinesis Stream. Documented below. A maximum of 1 are allowed.
- redshift
Target Property Map - Parameters used when you are using the rule to invoke an Amazon Redshift Statement. Documented below. A maximum of 1 are allowed.
- retry
Policy Property Map - Parameters used when you are providing retry policies. Documented below. A maximum of 1 are allowed.
- role
Arn String - The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered. Required if
ecs_target
is used or target inarn
is EC2 instance, Kinesis data stream, Step Functions state machine, or Event Bus in different account or region. - run
Command List<Property Map>Targets - Parameters used when you are using the rule to invoke Amazon EC2 Run Command. Documented below. A maximum of 5 are allowed.
- sagemaker
Pipeline Property MapTarget - Parameters used when you are using the rule to invoke an Amazon SageMaker Pipeline. Documented below. A maximum of 1 are allowed.
- sqs
Target Property Map - Parameters used when you are using the rule to invoke an Amazon SQS Queue. Documented below. A maximum of 1 are allowed.
- target
Id String - The unique target assignment ID. If missing, will generate a random, unique id.
Outputs
All input properties are implicitly available as output properties. Additionally, the EventTarget resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing EventTarget Resource
Get an existing EventTarget 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?: EventTargetState, opts?: CustomResourceOptions): EventTarget
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
appsync_target: Optional[EventTargetAppsyncTargetArgs] = None,
arn: Optional[str] = None,
batch_target: Optional[EventTargetBatchTargetArgs] = None,
dead_letter_config: Optional[EventTargetDeadLetterConfigArgs] = None,
ecs_target: Optional[EventTargetEcsTargetArgs] = None,
event_bus_name: Optional[str] = None,
force_destroy: Optional[bool] = None,
http_target: Optional[EventTargetHttpTargetArgs] = None,
input: Optional[str] = None,
input_path: Optional[str] = None,
input_transformer: Optional[EventTargetInputTransformerArgs] = None,
kinesis_target: Optional[EventTargetKinesisTargetArgs] = None,
redshift_target: Optional[EventTargetRedshiftTargetArgs] = None,
retry_policy: Optional[EventTargetRetryPolicyArgs] = None,
role_arn: Optional[str] = None,
rule: Optional[str] = None,
run_command_targets: Optional[Sequence[EventTargetRunCommandTargetArgs]] = None,
sagemaker_pipeline_target: Optional[EventTargetSagemakerPipelineTargetArgs] = None,
sqs_target: Optional[EventTargetSqsTargetArgs] = None,
target_id: Optional[str] = None) -> EventTarget
func GetEventTarget(ctx *Context, name string, id IDInput, state *EventTargetState, opts ...ResourceOption) (*EventTarget, error)
public static EventTarget Get(string name, Input<string> id, EventTargetState? state, CustomResourceOptions? opts = null)
public static EventTarget get(String name, Output<String> id, EventTargetState 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.
- Appsync
Target EventTarget Appsync Target - Parameters used when you are using the rule to invoke an AppSync GraphQL API mutation. Documented below. A maximum of 1 are allowed.
- Arn string
- The Amazon Resource Name (ARN) of the target.
- Batch
Target EventTarget Batch Target - Parameters used when you are using the rule to invoke an Amazon Batch Job. Documented below. A maximum of 1 are allowed.
- Dead
Letter EventConfig Target Dead Letter Config - Parameters used when you are providing a dead letter config. Documented below. A maximum of 1 are allowed.
- Ecs
Target EventTarget Ecs Target - Parameters used when you are using the rule to invoke Amazon ECS Task. Documented below. A maximum of 1 are allowed.
- Event
Bus stringName - The name or ARN of the event bus to associate with the rule.
If you omit this, the
default
event bus is used. - Force
Destroy bool - Used to delete managed rules created by AWS. Defaults to
false
. - Http
Target EventTarget Http Target - Parameters used when you are using the rule to invoke an API Gateway REST endpoint. Documented below. A maximum of 1 is allowed.
- Input string
- Valid JSON text passed to the target. Conflicts with
input_path
andinput_transformer
. - Input
Path string - The value of the JSONPath that is used for extracting part of the matched event when passing it to the target. Conflicts with
input
andinput_transformer
. - Input
Transformer EventTarget Input Transformer - Parameters used when you are providing a custom input to a target based on certain event data. Conflicts with
input
andinput_path
. - Kinesis
Target EventTarget Kinesis Target - Parameters used when you are using the rule to invoke an Amazon Kinesis Stream. Documented below. A maximum of 1 are allowed.
- Redshift
Target EventTarget Redshift Target - Parameters used when you are using the rule to invoke an Amazon Redshift Statement. Documented below. A maximum of 1 are allowed.
- Retry
Policy EventTarget Retry Policy - Parameters used when you are providing retry policies. Documented below. A maximum of 1 are allowed.
- Role
Arn string - The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered. Required if
ecs_target
is used or target inarn
is EC2 instance, Kinesis data stream, Step Functions state machine, or Event Bus in different account or region. - Rule string
The name of the rule you want to add targets to.
The following arguments are optional:
- Run
Command List<EventTargets Target Run Command Target> - Parameters used when you are using the rule to invoke Amazon EC2 Run Command. Documented below. A maximum of 5 are allowed.
- Sagemaker
Pipeline EventTarget Target Sagemaker Pipeline Target - Parameters used when you are using the rule to invoke an Amazon SageMaker Pipeline. Documented below. A maximum of 1 are allowed.
- Sqs
Target EventTarget Sqs Target - Parameters used when you are using the rule to invoke an Amazon SQS Queue. Documented below. A maximum of 1 are allowed.
- Target
Id string - The unique target assignment ID. If missing, will generate a random, unique id.
- Appsync
Target EventTarget Appsync Target Args - Parameters used when you are using the rule to invoke an AppSync GraphQL API mutation. Documented below. A maximum of 1 are allowed.
- Arn string
- The Amazon Resource Name (ARN) of the target.
- Batch
Target EventTarget Batch Target Args - Parameters used when you are using the rule to invoke an Amazon Batch Job. Documented below. A maximum of 1 are allowed.
- Dead
Letter EventConfig Target Dead Letter Config Args - Parameters used when you are providing a dead letter config. Documented below. A maximum of 1 are allowed.
- Ecs
Target EventTarget Ecs Target Args - Parameters used when you are using the rule to invoke Amazon ECS Task. Documented below. A maximum of 1 are allowed.
- Event
Bus stringName - The name or ARN of the event bus to associate with the rule.
If you omit this, the
default
event bus is used. - Force
Destroy bool - Used to delete managed rules created by AWS. Defaults to
false
. - Http
Target EventTarget Http Target Args - Parameters used when you are using the rule to invoke an API Gateway REST endpoint. Documented below. A maximum of 1 is allowed.
- Input string
- Valid JSON text passed to the target. Conflicts with
input_path
andinput_transformer
. - Input
Path string - The value of the JSONPath that is used for extracting part of the matched event when passing it to the target. Conflicts with
input
andinput_transformer
. - Input
Transformer EventTarget Input Transformer Args - Parameters used when you are providing a custom input to a target based on certain event data. Conflicts with
input
andinput_path
. - Kinesis
Target EventTarget Kinesis Target Args - Parameters used when you are using the rule to invoke an Amazon Kinesis Stream. Documented below. A maximum of 1 are allowed.
- Redshift
Target EventTarget Redshift Target Args - Parameters used when you are using the rule to invoke an Amazon Redshift Statement. Documented below. A maximum of 1 are allowed.
- Retry
Policy EventTarget Retry Policy Args - Parameters used when you are providing retry policies. Documented below. A maximum of 1 are allowed.
- Role
Arn string - The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered. Required if
ecs_target
is used or target inarn
is EC2 instance, Kinesis data stream, Step Functions state machine, or Event Bus in different account or region. - Rule string
The name of the rule you want to add targets to.
The following arguments are optional:
- Run
Command []EventTargets Target Run Command Target Args - Parameters used when you are using the rule to invoke Amazon EC2 Run Command. Documented below. A maximum of 5 are allowed.
- Sagemaker
Pipeline EventTarget Target Sagemaker Pipeline Target Args - Parameters used when you are using the rule to invoke an Amazon SageMaker Pipeline. Documented below. A maximum of 1 are allowed.
- Sqs
Target EventTarget Sqs Target Args - Parameters used when you are using the rule to invoke an Amazon SQS Queue. Documented below. A maximum of 1 are allowed.
- Target
Id string - The unique target assignment ID. If missing, will generate a random, unique id.
- appsync
Target EventTarget Appsync Target - Parameters used when you are using the rule to invoke an AppSync GraphQL API mutation. Documented below. A maximum of 1 are allowed.
- arn String
- The Amazon Resource Name (ARN) of the target.
- batch
Target EventTarget Batch Target - Parameters used when you are using the rule to invoke an Amazon Batch Job. Documented below. A maximum of 1 are allowed.
- dead
Letter EventConfig Target Dead Letter Config - Parameters used when you are providing a dead letter config. Documented below. A maximum of 1 are allowed.
- ecs
Target EventTarget Ecs Target - Parameters used when you are using the rule to invoke Amazon ECS Task. Documented below. A maximum of 1 are allowed.
- event
Bus StringName - The name or ARN of the event bus to associate with the rule.
If you omit this, the
default
event bus is used. - force
Destroy Boolean - Used to delete managed rules created by AWS. Defaults to
false
. - http
Target EventTarget Http Target - Parameters used when you are using the rule to invoke an API Gateway REST endpoint. Documented below. A maximum of 1 is allowed.
- input String
- Valid JSON text passed to the target. Conflicts with
input_path
andinput_transformer
. - input
Path String - The value of the JSONPath that is used for extracting part of the matched event when passing it to the target. Conflicts with
input
andinput_transformer
. - input
Transformer EventTarget Input Transformer - Parameters used when you are providing a custom input to a target based on certain event data. Conflicts with
input
andinput_path
. - kinesis
Target EventTarget Kinesis Target - Parameters used when you are using the rule to invoke an Amazon Kinesis Stream. Documented below. A maximum of 1 are allowed.
- redshift
Target EventTarget Redshift Target - Parameters used when you are using the rule to invoke an Amazon Redshift Statement. Documented below. A maximum of 1 are allowed.
- retry
Policy EventTarget Retry Policy - Parameters used when you are providing retry policies. Documented below. A maximum of 1 are allowed.
- role
Arn String - The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered. Required if
ecs_target
is used or target inarn
is EC2 instance, Kinesis data stream, Step Functions state machine, or Event Bus in different account or region. - rule String
The name of the rule you want to add targets to.
The following arguments are optional:
- run
Command List<EventTargets Target Run Command Target> - Parameters used when you are using the rule to invoke Amazon EC2 Run Command. Documented below. A maximum of 5 are allowed.
- sagemaker
Pipeline EventTarget Target Sagemaker Pipeline Target - Parameters used when you are using the rule to invoke an Amazon SageMaker Pipeline. Documented below. A maximum of 1 are allowed.
- sqs
Target EventTarget Sqs Target - Parameters used when you are using the rule to invoke an Amazon SQS Queue. Documented below. A maximum of 1 are allowed.
- target
Id String - The unique target assignment ID. If missing, will generate a random, unique id.
- appsync
Target EventTarget Appsync Target - Parameters used when you are using the rule to invoke an AppSync GraphQL API mutation. Documented below. A maximum of 1 are allowed.
- arn string
- The Amazon Resource Name (ARN) of the target.
- batch
Target EventTarget Batch Target - Parameters used when you are using the rule to invoke an Amazon Batch Job. Documented below. A maximum of 1 are allowed.
- dead
Letter EventConfig Target Dead Letter Config - Parameters used when you are providing a dead letter config. Documented below. A maximum of 1 are allowed.
- ecs
Target EventTarget Ecs Target - Parameters used when you are using the rule to invoke Amazon ECS Task. Documented below. A maximum of 1 are allowed.
- event
Bus stringName - The name or ARN of the event bus to associate with the rule.
If you omit this, the
default
event bus is used. - force
Destroy boolean - Used to delete managed rules created by AWS. Defaults to
false
. - http
Target EventTarget Http Target - Parameters used when you are using the rule to invoke an API Gateway REST endpoint. Documented below. A maximum of 1 is allowed.
- input string
- Valid JSON text passed to the target. Conflicts with
input_path
andinput_transformer
. - input
Path string - The value of the JSONPath that is used for extracting part of the matched event when passing it to the target. Conflicts with
input
andinput_transformer
. - input
Transformer EventTarget Input Transformer - Parameters used when you are providing a custom input to a target based on certain event data. Conflicts with
input
andinput_path
. - kinesis
Target EventTarget Kinesis Target - Parameters used when you are using the rule to invoke an Amazon Kinesis Stream. Documented below. A maximum of 1 are allowed.
- redshift
Target EventTarget Redshift Target - Parameters used when you are using the rule to invoke an Amazon Redshift Statement. Documented below. A maximum of 1 are allowed.
- retry
Policy EventTarget Retry Policy - Parameters used when you are providing retry policies. Documented below. A maximum of 1 are allowed.
- role
Arn string - The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered. Required if
ecs_target
is used or target inarn
is EC2 instance, Kinesis data stream, Step Functions state machine, or Event Bus in different account or region. - rule string
The name of the rule you want to add targets to.
The following arguments are optional:
- run
Command EventTargets Target Run Command Target[] - Parameters used when you are using the rule to invoke Amazon EC2 Run Command. Documented below. A maximum of 5 are allowed.
- sagemaker
Pipeline EventTarget Target Sagemaker Pipeline Target - Parameters used when you are using the rule to invoke an Amazon SageMaker Pipeline. Documented below. A maximum of 1 are allowed.
- sqs
Target EventTarget Sqs Target - Parameters used when you are using the rule to invoke an Amazon SQS Queue. Documented below. A maximum of 1 are allowed.
- target
Id string - The unique target assignment ID. If missing, will generate a random, unique id.
- appsync_
target EventTarget Appsync Target Args - Parameters used when you are using the rule to invoke an AppSync GraphQL API mutation. Documented below. A maximum of 1 are allowed.
- arn str
- The Amazon Resource Name (ARN) of the target.
- batch_
target EventTarget Batch Target Args - Parameters used when you are using the rule to invoke an Amazon Batch Job. Documented below. A maximum of 1 are allowed.
- dead_
letter_ Eventconfig Target Dead Letter Config Args - Parameters used when you are providing a dead letter config. Documented below. A maximum of 1 are allowed.
- ecs_
target EventTarget Ecs Target Args - Parameters used when you are using the rule to invoke Amazon ECS Task. Documented below. A maximum of 1 are allowed.
- event_
bus_ strname - The name or ARN of the event bus to associate with the rule.
If you omit this, the
default
event bus is used. - force_
destroy bool - Used to delete managed rules created by AWS. Defaults to
false
. - http_
target EventTarget Http Target Args - Parameters used when you are using the rule to invoke an API Gateway REST endpoint. Documented below. A maximum of 1 is allowed.
- input str
- Valid JSON text passed to the target. Conflicts with
input_path
andinput_transformer
. - input_
path str - The value of the JSONPath that is used for extracting part of the matched event when passing it to the target. Conflicts with
input
andinput_transformer
. - input_
transformer EventTarget Input Transformer Args - Parameters used when you are providing a custom input to a target based on certain event data. Conflicts with
input
andinput_path
. - kinesis_
target EventTarget Kinesis Target Args - Parameters used when you are using the rule to invoke an Amazon Kinesis Stream. Documented below. A maximum of 1 are allowed.
- redshift_
target EventTarget Redshift Target Args - Parameters used when you are using the rule to invoke an Amazon Redshift Statement. Documented below. A maximum of 1 are allowed.
- retry_
policy EventTarget Retry Policy Args - Parameters used when you are providing retry policies. Documented below. A maximum of 1 are allowed.
- role_
arn str - The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered. Required if
ecs_target
is used or target inarn
is EC2 instance, Kinesis data stream, Step Functions state machine, or Event Bus in different account or region. - rule str
The name of the rule you want to add targets to.
The following arguments are optional:
- run_
command_ Sequence[Eventtargets Target Run Command Target Args] - Parameters used when you are using the rule to invoke Amazon EC2 Run Command. Documented below. A maximum of 5 are allowed.
- sagemaker_
pipeline_ Eventtarget Target Sagemaker Pipeline Target Args - Parameters used when you are using the rule to invoke an Amazon SageMaker Pipeline. Documented below. A maximum of 1 are allowed.
- sqs_
target EventTarget Sqs Target Args - Parameters used when you are using the rule to invoke an Amazon SQS Queue. Documented below. A maximum of 1 are allowed.
- target_
id str - The unique target assignment ID. If missing, will generate a random, unique id.
- appsync
Target Property Map - Parameters used when you are using the rule to invoke an AppSync GraphQL API mutation. Documented below. A maximum of 1 are allowed.
- arn String
- The Amazon Resource Name (ARN) of the target.
- batch
Target Property Map - Parameters used when you are using the rule to invoke an Amazon Batch Job. Documented below. A maximum of 1 are allowed.
- dead
Letter Property MapConfig - Parameters used when you are providing a dead letter config. Documented below. A maximum of 1 are allowed.
- ecs
Target Property Map - Parameters used when you are using the rule to invoke Amazon ECS Task. Documented below. A maximum of 1 are allowed.
- event
Bus StringName - The name or ARN of the event bus to associate with the rule.
If you omit this, the
default
event bus is used. - force
Destroy Boolean - Used to delete managed rules created by AWS. Defaults to
false
. - http
Target Property Map - Parameters used when you are using the rule to invoke an API Gateway REST endpoint. Documented below. A maximum of 1 is allowed.
- input String
- Valid JSON text passed to the target. Conflicts with
input_path
andinput_transformer
. - input
Path String - The value of the JSONPath that is used for extracting part of the matched event when passing it to the target. Conflicts with
input
andinput_transformer
. - input
Transformer Property Map - Parameters used when you are providing a custom input to a target based on certain event data. Conflicts with
input
andinput_path
. - kinesis
Target Property Map - Parameters used when you are using the rule to invoke an Amazon Kinesis Stream. Documented below. A maximum of 1 are allowed.
- redshift
Target Property Map - Parameters used when you are using the rule to invoke an Amazon Redshift Statement. Documented below. A maximum of 1 are allowed.
- retry
Policy Property Map - Parameters used when you are providing retry policies. Documented below. A maximum of 1 are allowed.
- role
Arn String - The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered. Required if
ecs_target
is used or target inarn
is EC2 instance, Kinesis data stream, Step Functions state machine, or Event Bus in different account or region. - rule String
The name of the rule you want to add targets to.
The following arguments are optional:
- run
Command List<Property Map>Targets - Parameters used when you are using the rule to invoke Amazon EC2 Run Command. Documented below. A maximum of 5 are allowed.
- sagemaker
Pipeline Property MapTarget - Parameters used when you are using the rule to invoke an Amazon SageMaker Pipeline. Documented below. A maximum of 1 are allowed.
- sqs
Target Property Map - Parameters used when you are using the rule to invoke an Amazon SQS Queue. Documented below. A maximum of 1 are allowed.
- target
Id String - The unique target assignment ID. If missing, will generate a random, unique id.
Supporting Types
EventTargetAppsyncTarget, EventTargetAppsyncTargetArgs
- Graphql
Operation string - Contains the GraphQL mutation to be parsed and executed.
- Graphql
Operation string - Contains the GraphQL mutation to be parsed and executed.
- graphql
Operation String - Contains the GraphQL mutation to be parsed and executed.
- graphql
Operation string - Contains the GraphQL mutation to be parsed and executed.
- graphql_
operation str - Contains the GraphQL mutation to be parsed and executed.
- graphql
Operation String - Contains the GraphQL mutation to be parsed and executed.
EventTargetBatchTarget, EventTargetBatchTargetArgs
- Job
Definition string - The ARN or name of the job definition to use if the event target is an AWS Batch job. This job definition must already exist.
- Job
Name string - The name to use for this execution of the job, if the target is an AWS Batch job.
- Array
Size int - The size of the array, if this is an array batch job. Valid values are integers between 2 and 10,000.
- Job
Attempts int - The number of times to attempt to retry, if the job fails. Valid values are 1 to 10.
- Job
Definition string - The ARN or name of the job definition to use if the event target is an AWS Batch job. This job definition must already exist.
- Job
Name string - The name to use for this execution of the job, if the target is an AWS Batch job.
- Array
Size int - The size of the array, if this is an array batch job. Valid values are integers between 2 and 10,000.
- Job
Attempts int - The number of times to attempt to retry, if the job fails. Valid values are 1 to 10.
- job
Definition String - The ARN or name of the job definition to use if the event target is an AWS Batch job. This job definition must already exist.
- job
Name String - The name to use for this execution of the job, if the target is an AWS Batch job.
- array
Size Integer - The size of the array, if this is an array batch job. Valid values are integers between 2 and 10,000.
- job
Attempts Integer - The number of times to attempt to retry, if the job fails. Valid values are 1 to 10.
- job
Definition string - The ARN or name of the job definition to use if the event target is an AWS Batch job. This job definition must already exist.
- job
Name string - The name to use for this execution of the job, if the target is an AWS Batch job.
- array
Size number - The size of the array, if this is an array batch job. Valid values are integers between 2 and 10,000.
- job
Attempts number - The number of times to attempt to retry, if the job fails. Valid values are 1 to 10.
- job_
definition str - The ARN or name of the job definition to use if the event target is an AWS Batch job. This job definition must already exist.
- job_
name str - The name to use for this execution of the job, if the target is an AWS Batch job.
- array_
size int - The size of the array, if this is an array batch job. Valid values are integers between 2 and 10,000.
- job_
attempts int - The number of times to attempt to retry, if the job fails. Valid values are 1 to 10.
- job
Definition String - The ARN or name of the job definition to use if the event target is an AWS Batch job. This job definition must already exist.
- job
Name String - The name to use for this execution of the job, if the target is an AWS Batch job.
- array
Size Number - The size of the array, if this is an array batch job. Valid values are integers between 2 and 10,000.
- job
Attempts Number - The number of times to attempt to retry, if the job fails. Valid values are 1 to 10.
EventTargetDeadLetterConfig, EventTargetDeadLetterConfigArgs
- Arn string
- ARN of the SQS queue specified as the target for the dead-letter queue.
- Arn string
- ARN of the SQS queue specified as the target for the dead-letter queue.
- arn String
- ARN of the SQS queue specified as the target for the dead-letter queue.
- arn string
- ARN of the SQS queue specified as the target for the dead-letter queue.
- arn str
- ARN of the SQS queue specified as the target for the dead-letter queue.
- arn String
- ARN of the SQS queue specified as the target for the dead-letter queue.
EventTargetEcsTarget, EventTargetEcsTargetArgs
- Task
Definition stringArn - The ARN of the task definition to use if the event target is an Amazon ECS cluster.
- Capacity
Provider List<EventStrategies Target Ecs Target Capacity Provider Strategy> - The capacity provider strategy to use for the task. If a
capacity_provider_strategy
specified, thelaunch_type
parameter must be omitted. If nocapacity_provider_strategy
orlaunch_type
is specified, the default capacity provider strategy for the cluster is used. Can be one or more. See below. - bool
- Specifies whether to enable Amazon ECS managed tags for the task.
- Enable
Execute boolCommand - Whether or not to enable the execute command functionality for the containers in this task. If true, this enables execute command functionality on all containers in the task.
- Group string
- Specifies an ECS task group for the task. The maximum length is 255 characters.
- Launch
Type string - Specifies the launch type on which your task is running. The launch type that you specify here must match one of the launch type (compatibilities) of the target task. Valid values include:
EC2
,EXTERNAL
, orFARGATE
. - Network
Configuration EventTarget Ecs Target Network Configuration - Use this if the ECS task uses the awsvpc network mode. This specifies the VPC subnets and security groups associated with the task, and whether a public IP address is to be used. Required if
launch_type
isFARGATE
because the awsvpc mode is required for Fargate tasks. - Ordered
Placement List<EventStrategies Target Ecs Target Ordered Placement Strategy> - An array of placement strategy objects to use for the task. You can specify a maximum of five strategy rules per task.
- Placement
Constraints List<EventTarget Ecs Target Placement Constraint> - An array of placement constraint objects to use for the task. You can specify up to 10 constraints per task (including constraints in the task definition and those specified at runtime). See Below.
- Platform
Version string - Specifies the platform version for the task. Specify only the numeric portion of the platform version, such as
1.1.0
. This is used only if LaunchType is FARGATE. For more information about valid platform versions, see AWS Fargate Platform Versions. - string
- Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags are not propagated. Tags can only be propagated to the task during task creation. The only valid value is:
TASK_DEFINITION
. - Dictionary<string, string>
- A map of tags to assign to ecs resources.
- Task
Count int - The number of tasks to create based on the TaskDefinition. Defaults to
1
.
- Task
Definition stringArn - The ARN of the task definition to use if the event target is an Amazon ECS cluster.
- Capacity
Provider []EventStrategies Target Ecs Target Capacity Provider Strategy - The capacity provider strategy to use for the task. If a
capacity_provider_strategy
specified, thelaunch_type
parameter must be omitted. If nocapacity_provider_strategy
orlaunch_type
is specified, the default capacity provider strategy for the cluster is used. Can be one or more. See below. - bool
- Specifies whether to enable Amazon ECS managed tags for the task.
- Enable
Execute boolCommand - Whether or not to enable the execute command functionality for the containers in this task. If true, this enables execute command functionality on all containers in the task.
- Group string
- Specifies an ECS task group for the task. The maximum length is 255 characters.
- Launch
Type string - Specifies the launch type on which your task is running. The launch type that you specify here must match one of the launch type (compatibilities) of the target task. Valid values include:
EC2
,EXTERNAL
, orFARGATE
. - Network
Configuration EventTarget Ecs Target Network Configuration - Use this if the ECS task uses the awsvpc network mode. This specifies the VPC subnets and security groups associated with the task, and whether a public IP address is to be used. Required if
launch_type
isFARGATE
because the awsvpc mode is required for Fargate tasks. - Ordered
Placement []EventStrategies Target Ecs Target Ordered Placement Strategy - An array of placement strategy objects to use for the task. You can specify a maximum of five strategy rules per task.
- Placement
Constraints []EventTarget Ecs Target Placement Constraint - An array of placement constraint objects to use for the task. You can specify up to 10 constraints per task (including constraints in the task definition and those specified at runtime). See Below.
- Platform
Version string - Specifies the platform version for the task. Specify only the numeric portion of the platform version, such as
1.1.0
. This is used only if LaunchType is FARGATE. For more information about valid platform versions, see AWS Fargate Platform Versions. - string
- Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags are not propagated. Tags can only be propagated to the task during task creation. The only valid value is:
TASK_DEFINITION
. - map[string]string
- A map of tags to assign to ecs resources.
- Task
Count int - The number of tasks to create based on the TaskDefinition. Defaults to
1
.
- task
Definition StringArn - The ARN of the task definition to use if the event target is an Amazon ECS cluster.
- capacity
Provider List<EventStrategies Target Ecs Target Capacity Provider Strategy> - The capacity provider strategy to use for the task. If a
capacity_provider_strategy
specified, thelaunch_type
parameter must be omitted. If nocapacity_provider_strategy
orlaunch_type
is specified, the default capacity provider strategy for the cluster is used. Can be one or more. See below. - Boolean
- Specifies whether to enable Amazon ECS managed tags for the task.
- enable
Execute BooleanCommand - Whether or not to enable the execute command functionality for the containers in this task. If true, this enables execute command functionality on all containers in the task.
- group String
- Specifies an ECS task group for the task. The maximum length is 255 characters.
- launch
Type String - Specifies the launch type on which your task is running. The launch type that you specify here must match one of the launch type (compatibilities) of the target task. Valid values include:
EC2
,EXTERNAL
, orFARGATE
. - network
Configuration EventTarget Ecs Target Network Configuration - Use this if the ECS task uses the awsvpc network mode. This specifies the VPC subnets and security groups associated with the task, and whether a public IP address is to be used. Required if
launch_type
isFARGATE
because the awsvpc mode is required for Fargate tasks. - ordered
Placement List<EventStrategies Target Ecs Target Ordered Placement Strategy> - An array of placement strategy objects to use for the task. You can specify a maximum of five strategy rules per task.
- placement
Constraints List<EventTarget Ecs Target Placement Constraint> - An array of placement constraint objects to use for the task. You can specify up to 10 constraints per task (including constraints in the task definition and those specified at runtime). See Below.
- platform
Version String - Specifies the platform version for the task. Specify only the numeric portion of the platform version, such as
1.1.0
. This is used only if LaunchType is FARGATE. For more information about valid platform versions, see AWS Fargate Platform Versions. - String
- Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags are not propagated. Tags can only be propagated to the task during task creation. The only valid value is:
TASK_DEFINITION
. - Map<String,String>
- A map of tags to assign to ecs resources.
- task
Count Integer - The number of tasks to create based on the TaskDefinition. Defaults to
1
.
- task
Definition stringArn - The ARN of the task definition to use if the event target is an Amazon ECS cluster.
- capacity
Provider EventStrategies Target Ecs Target Capacity Provider Strategy[] - The capacity provider strategy to use for the task. If a
capacity_provider_strategy
specified, thelaunch_type
parameter must be omitted. If nocapacity_provider_strategy
orlaunch_type
is specified, the default capacity provider strategy for the cluster is used. Can be one or more. See below. - boolean
- Specifies whether to enable Amazon ECS managed tags for the task.
- enable
Execute booleanCommand - Whether or not to enable the execute command functionality for the containers in this task. If true, this enables execute command functionality on all containers in the task.
- group string
- Specifies an ECS task group for the task. The maximum length is 255 characters.
- launch
Type string - Specifies the launch type on which your task is running. The launch type that you specify here must match one of the launch type (compatibilities) of the target task. Valid values include:
EC2
,EXTERNAL
, orFARGATE
. - network
Configuration EventTarget Ecs Target Network Configuration - Use this if the ECS task uses the awsvpc network mode. This specifies the VPC subnets and security groups associated with the task, and whether a public IP address is to be used. Required if
launch_type
isFARGATE
because the awsvpc mode is required for Fargate tasks. - ordered
Placement EventStrategies Target Ecs Target Ordered Placement Strategy[] - An array of placement strategy objects to use for the task. You can specify a maximum of five strategy rules per task.
- placement
Constraints EventTarget Ecs Target Placement Constraint[] - An array of placement constraint objects to use for the task. You can specify up to 10 constraints per task (including constraints in the task definition and those specified at runtime). See Below.
- platform
Version string - Specifies the platform version for the task. Specify only the numeric portion of the platform version, such as
1.1.0
. This is used only if LaunchType is FARGATE. For more information about valid platform versions, see AWS Fargate Platform Versions. - string
- Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags are not propagated. Tags can only be propagated to the task during task creation. The only valid value is:
TASK_DEFINITION
. - {[key: string]: string}
- A map of tags to assign to ecs resources.
- task
Count number - The number of tasks to create based on the TaskDefinition. Defaults to
1
.
- task_
definition_ strarn - The ARN of the task definition to use if the event target is an Amazon ECS cluster.
- capacity_
provider_ Sequence[Eventstrategies Target Ecs Target Capacity Provider Strategy] - The capacity provider strategy to use for the task. If a
capacity_provider_strategy
specified, thelaunch_type
parameter must be omitted. If nocapacity_provider_strategy
orlaunch_type
is specified, the default capacity provider strategy for the cluster is used. Can be one or more. See below. - bool
- Specifies whether to enable Amazon ECS managed tags for the task.
- enable_
execute_ boolcommand - Whether or not to enable the execute command functionality for the containers in this task. If true, this enables execute command functionality on all containers in the task.
- group str
- Specifies an ECS task group for the task. The maximum length is 255 characters.
- launch_
type str - Specifies the launch type on which your task is running. The launch type that you specify here must match one of the launch type (compatibilities) of the target task. Valid values include:
EC2
,EXTERNAL
, orFARGATE
. - network_
configuration EventTarget Ecs Target Network Configuration - Use this if the ECS task uses the awsvpc network mode. This specifies the VPC subnets and security groups associated with the task, and whether a public IP address is to be used. Required if
launch_type
isFARGATE
because the awsvpc mode is required for Fargate tasks. - ordered_
placement_ Sequence[Eventstrategies Target Ecs Target Ordered Placement Strategy] - An array of placement strategy objects to use for the task. You can specify a maximum of five strategy rules per task.
- placement_
constraints Sequence[EventTarget Ecs Target Placement Constraint] - An array of placement constraint objects to use for the task. You can specify up to 10 constraints per task (including constraints in the task definition and those specified at runtime). See Below.
- platform_
version str - Specifies the platform version for the task. Specify only the numeric portion of the platform version, such as
1.1.0
. This is used only if LaunchType is FARGATE. For more information about valid platform versions, see AWS Fargate Platform Versions. - str
- Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags are not propagated. Tags can only be propagated to the task during task creation. The only valid value is:
TASK_DEFINITION
. - Mapping[str, str]
- A map of tags to assign to ecs resources.
- task_
count int - The number of tasks to create based on the TaskDefinition. Defaults to
1
.
- task
Definition StringArn - The ARN of the task definition to use if the event target is an Amazon ECS cluster.
- capacity
Provider List<Property Map>Strategies - The capacity provider strategy to use for the task. If a
capacity_provider_strategy
specified, thelaunch_type
parameter must be omitted. If nocapacity_provider_strategy
orlaunch_type
is specified, the default capacity provider strategy for the cluster is used. Can be one or more. See below. - Boolean
- Specifies whether to enable Amazon ECS managed tags for the task.
- enable
Execute BooleanCommand - Whether or not to enable the execute command functionality for the containers in this task. If true, this enables execute command functionality on all containers in the task.
- group String
- Specifies an ECS task group for the task. The maximum length is 255 characters.
- launch
Type String - Specifies the launch type on which your task is running. The launch type that you specify here must match one of the launch type (compatibilities) of the target task. Valid values include:
EC2
,EXTERNAL
, orFARGATE
. - network
Configuration Property Map - Use this if the ECS task uses the awsvpc network mode. This specifies the VPC subnets and security groups associated with the task, and whether a public IP address is to be used. Required if
launch_type
isFARGATE
because the awsvpc mode is required for Fargate tasks. - ordered
Placement List<Property Map>Strategies - An array of placement strategy objects to use for the task. You can specify a maximum of five strategy rules per task.
- placement
Constraints List<Property Map> - An array of placement constraint objects to use for the task. You can specify up to 10 constraints per task (including constraints in the task definition and those specified at runtime). See Below.
- platform
Version String - Specifies the platform version for the task. Specify only the numeric portion of the platform version, such as
1.1.0
. This is used only if LaunchType is FARGATE. For more information about valid platform versions, see AWS Fargate Platform Versions. - String
- Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags are not propagated. Tags can only be propagated to the task during task creation. The only valid value is:
TASK_DEFINITION
. - Map<String>
- A map of tags to assign to ecs resources.
- task
Count Number - The number of tasks to create based on the TaskDefinition. Defaults to
1
.
EventTargetEcsTargetCapacityProviderStrategy, EventTargetEcsTargetCapacityProviderStrategyArgs
- Capacity
Provider string - Short name of the capacity provider.
- Base int
- The base value designates how many tasks, at a minimum, to run on the specified capacity provider. Only one capacity provider in a capacity provider strategy can have a base defined. Defaults to
0
. - Weight int
- The weight value designates the relative percentage of the total number of tasks launched that should use the specified capacity provider. The weight value is taken into consideration after the base value, if defined, is satisfied.
- Capacity
Provider string - Short name of the capacity provider.
- Base int
- The base value designates how many tasks, at a minimum, to run on the specified capacity provider. Only one capacity provider in a capacity provider strategy can have a base defined. Defaults to
0
. - Weight int
- The weight value designates the relative percentage of the total number of tasks launched that should use the specified capacity provider. The weight value is taken into consideration after the base value, if defined, is satisfied.
- capacity
Provider String - Short name of the capacity provider.
- base Integer
- The base value designates how many tasks, at a minimum, to run on the specified capacity provider. Only one capacity provider in a capacity provider strategy can have a base defined. Defaults to
0
. - weight Integer
- The weight value designates the relative percentage of the total number of tasks launched that should use the specified capacity provider. The weight value is taken into consideration after the base value, if defined, is satisfied.
- capacity
Provider string - Short name of the capacity provider.
- base number
- The base value designates how many tasks, at a minimum, to run on the specified capacity provider. Only one capacity provider in a capacity provider strategy can have a base defined. Defaults to
0
. - weight number
- The weight value designates the relative percentage of the total number of tasks launched that should use the specified capacity provider. The weight value is taken into consideration after the base value, if defined, is satisfied.
- capacity_
provider str - Short name of the capacity provider.
- base int
- The base value designates how many tasks, at a minimum, to run on the specified capacity provider. Only one capacity provider in a capacity provider strategy can have a base defined. Defaults to
0
. - weight int
- The weight value designates the relative percentage of the total number of tasks launched that should use the specified capacity provider. The weight value is taken into consideration after the base value, if defined, is satisfied.
- capacity
Provider String - Short name of the capacity provider.
- base Number
- The base value designates how many tasks, at a minimum, to run on the specified capacity provider. Only one capacity provider in a capacity provider strategy can have a base defined. Defaults to
0
. - weight Number
- The weight value designates the relative percentage of the total number of tasks launched that should use the specified capacity provider. The weight value is taken into consideration after the base value, if defined, is satisfied.
EventTargetEcsTargetNetworkConfiguration, EventTargetEcsTargetNetworkConfigurationArgs
- Subnets List<string>
- The subnets associated with the task or service.
- Assign
Public boolIp Assign a public IP address to the ENI (Fargate launch type only). Valid values are
true
orfalse
. Defaults tofalse
.For more information, see Task Networking
- Security
Groups List<string> - The security groups associated with the task or service. If you do not specify a security group, the default security group for the VPC is used.
- Subnets []string
- The subnets associated with the task or service.
- Assign
Public boolIp Assign a public IP address to the ENI (Fargate launch type only). Valid values are
true
orfalse
. Defaults tofalse
.For more information, see Task Networking
- Security
Groups []string - The security groups associated with the task or service. If you do not specify a security group, the default security group for the VPC is used.
- subnets List<String>
- The subnets associated with the task or service.
- assign
Public BooleanIp Assign a public IP address to the ENI (Fargate launch type only). Valid values are
true
orfalse
. Defaults tofalse
.For more information, see Task Networking
- security
Groups List<String> - The security groups associated with the task or service. If you do not specify a security group, the default security group for the VPC is used.
- subnets string[]
- The subnets associated with the task or service.
- assign
Public booleanIp Assign a public IP address to the ENI (Fargate launch type only). Valid values are
true
orfalse
. Defaults tofalse
.For more information, see Task Networking
- security
Groups string[] - The security groups associated with the task or service. If you do not specify a security group, the default security group for the VPC is used.
- subnets Sequence[str]
- The subnets associated with the task or service.
- assign_
public_ boolip Assign a public IP address to the ENI (Fargate launch type only). Valid values are
true
orfalse
. Defaults tofalse
.For more information, see Task Networking
- security_
groups Sequence[str] - The security groups associated with the task or service. If you do not specify a security group, the default security group for the VPC is used.
- subnets List<String>
- The subnets associated with the task or service.
- assign
Public BooleanIp Assign a public IP address to the ENI (Fargate launch type only). Valid values are
true
orfalse
. Defaults tofalse
.For more information, see Task Networking
- security
Groups List<String> - The security groups associated with the task or service. If you do not specify a security group, the default security group for the VPC is used.
EventTargetEcsTargetOrderedPlacementStrategy, EventTargetEcsTargetOrderedPlacementStrategyArgs
- Type string
- Type of placement strategy. The only valid values at this time are
binpack
,random
andspread
. - Field string
- The field to apply the placement strategy against. For the
spread
placement strategy, valid values areinstanceId
(orhost
, which has the same effect), or any platform or custom attribute that is applied to a container instance, such asattribute:ecs.availability-zone
. For thebinpack
placement strategy, valid values arecpu
andmemory
. For therandom
placement strategy, this field is not used. For more information, see Amazon ECS task placement strategies.
- Type string
- Type of placement strategy. The only valid values at this time are
binpack
,random
andspread
. - Field string
- The field to apply the placement strategy against. For the
spread
placement strategy, valid values areinstanceId
(orhost
, which has the same effect), or any platform or custom attribute that is applied to a container instance, such asattribute:ecs.availability-zone
. For thebinpack
placement strategy, valid values arecpu
andmemory
. For therandom
placement strategy, this field is not used. For more information, see Amazon ECS task placement strategies.
- type String
- Type of placement strategy. The only valid values at this time are
binpack
,random
andspread
. - field String
- The field to apply the placement strategy against. For the
spread
placement strategy, valid values areinstanceId
(orhost
, which has the same effect), or any platform or custom attribute that is applied to a container instance, such asattribute:ecs.availability-zone
. For thebinpack
placement strategy, valid values arecpu
andmemory
. For therandom
placement strategy, this field is not used. For more information, see Amazon ECS task placement strategies.
- type string
- Type of placement strategy. The only valid values at this time are
binpack
,random
andspread
. - field string
- The field to apply the placement strategy against. For the
spread
placement strategy, valid values areinstanceId
(orhost
, which has the same effect), or any platform or custom attribute that is applied to a container instance, such asattribute:ecs.availability-zone
. For thebinpack
placement strategy, valid values arecpu
andmemory
. For therandom
placement strategy, this field is not used. For more information, see Amazon ECS task placement strategies.
- type str
- Type of placement strategy. The only valid values at this time are
binpack
,random
andspread
. - field str
- The field to apply the placement strategy against. For the
spread
placement strategy, valid values areinstanceId
(orhost
, which has the same effect), or any platform or custom attribute that is applied to a container instance, such asattribute:ecs.availability-zone
. For thebinpack
placement strategy, valid values arecpu
andmemory
. For therandom
placement strategy, this field is not used. For more information, see Amazon ECS task placement strategies.
- type String
- Type of placement strategy. The only valid values at this time are
binpack
,random
andspread
. - field String
- The field to apply the placement strategy against. For the
spread
placement strategy, valid values areinstanceId
(orhost
, which has the same effect), or any platform or custom attribute that is applied to a container instance, such asattribute:ecs.availability-zone
. For thebinpack
placement strategy, valid values arecpu
andmemory
. For therandom
placement strategy, this field is not used. For more information, see Amazon ECS task placement strategies.
EventTargetEcsTargetPlacementConstraint, EventTargetEcsTargetPlacementConstraintArgs
- Type string
- Type of constraint. The only valid values at this time are
memberOf
anddistinctInstance
. - Expression string
- Cluster Query Language expression to apply to the constraint. Does not need to be specified for the
distinctInstance
type. For more information, see Cluster Query Language in the Amazon EC2 Container Service Developer Guide.
- Type string
- Type of constraint. The only valid values at this time are
memberOf
anddistinctInstance
. - Expression string
- Cluster Query Language expression to apply to the constraint. Does not need to be specified for the
distinctInstance
type. For more information, see Cluster Query Language in the Amazon EC2 Container Service Developer Guide.
- type String
- Type of constraint. The only valid values at this time are
memberOf
anddistinctInstance
. - expression String
- Cluster Query Language expression to apply to the constraint. Does not need to be specified for the
distinctInstance
type. For more information, see Cluster Query Language in the Amazon EC2 Container Service Developer Guide.
- type string
- Type of constraint. The only valid values at this time are
memberOf
anddistinctInstance
. - expression string
- Cluster Query Language expression to apply to the constraint. Does not need to be specified for the
distinctInstance
type. For more information, see Cluster Query Language in the Amazon EC2 Container Service Developer Guide.
- type str
- Type of constraint. The only valid values at this time are
memberOf
anddistinctInstance
. - expression str
- Cluster Query Language expression to apply to the constraint. Does not need to be specified for the
distinctInstance
type. For more information, see Cluster Query Language in the Amazon EC2 Container Service Developer Guide.
- type String
- Type of constraint. The only valid values at this time are
memberOf
anddistinctInstance
. - expression String
- Cluster Query Language expression to apply to the constraint. Does not need to be specified for the
distinctInstance
type. For more information, see Cluster Query Language in the Amazon EC2 Container Service Developer Guide.
EventTargetHttpTarget, EventTargetHttpTargetArgs
- Header
Parameters Dictionary<string, string> - Enables you to specify HTTP headers to add to the request.
- Path
Parameter List<string>Values - The list of values that correspond sequentially to any path variables in your endpoint ARN (for example
arn:aws:execute-api:us-east-1:123456:myapi/*/POST/pets/*
). - Query
String Dictionary<string, string>Parameters - Represents keys/values of query string parameters that are appended to the invoked endpoint.
- Header
Parameters map[string]string - Enables you to specify HTTP headers to add to the request.
- Path
Parameter []stringValues - The list of values that correspond sequentially to any path variables in your endpoint ARN (for example
arn:aws:execute-api:us-east-1:123456:myapi/*/POST/pets/*
). - Query
String map[string]stringParameters - Represents keys/values of query string parameters that are appended to the invoked endpoint.
- header
Parameters Map<String,String> - Enables you to specify HTTP headers to add to the request.
- path
Parameter List<String>Values - The list of values that correspond sequentially to any path variables in your endpoint ARN (for example
arn:aws:execute-api:us-east-1:123456:myapi/*/POST/pets/*
). - query
String Map<String,String>Parameters - Represents keys/values of query string parameters that are appended to the invoked endpoint.
- header
Parameters {[key: string]: string} - Enables you to specify HTTP headers to add to the request.
- path
Parameter string[]Values - The list of values that correspond sequentially to any path variables in your endpoint ARN (for example
arn:aws:execute-api:us-east-1:123456:myapi/*/POST/pets/*
). - query
String {[key: string]: string}Parameters - Represents keys/values of query string parameters that are appended to the invoked endpoint.
- header_
parameters Mapping[str, str] - Enables you to specify HTTP headers to add to the request.
- path_
parameter_ Sequence[str]values - The list of values that correspond sequentially to any path variables in your endpoint ARN (for example
arn:aws:execute-api:us-east-1:123456:myapi/*/POST/pets/*
). - query_
string_ Mapping[str, str]parameters - Represents keys/values of query string parameters that are appended to the invoked endpoint.
- header
Parameters Map<String> - Enables you to specify HTTP headers to add to the request.
- path
Parameter List<String>Values - The list of values that correspond sequentially to any path variables in your endpoint ARN (for example
arn:aws:execute-api:us-east-1:123456:myapi/*/POST/pets/*
). - query
String Map<String>Parameters - Represents keys/values of query string parameters that are appended to the invoked endpoint.
EventTargetInputTransformer, EventTargetInputTransformerArgs
- Input
Template string - Template to customize data sent to the target. Must be valid JSON. To send a string value, the string value must include double quotes.
- Input
Paths Dictionary<string, string> - Key value pairs specified in the form of JSONPath (for example, time = $.time)
- You can have as many as 100 key-value pairs.
- You must use JSON dot notation, not bracket notation.
- The keys can't start with "AWS".
- Input
Template string - Template to customize data sent to the target. Must be valid JSON. To send a string value, the string value must include double quotes.
- Input
Paths map[string]string - Key value pairs specified in the form of JSONPath (for example, time = $.time)
- You can have as many as 100 key-value pairs.
- You must use JSON dot notation, not bracket notation.
- The keys can't start with "AWS".
- input
Template String - Template to customize data sent to the target. Must be valid JSON. To send a string value, the string value must include double quotes.
- input
Paths Map<String,String> - Key value pairs specified in the form of JSONPath (for example, time = $.time)
- You can have as many as 100 key-value pairs.
- You must use JSON dot notation, not bracket notation.
- The keys can't start with "AWS".
- input
Template string - Template to customize data sent to the target. Must be valid JSON. To send a string value, the string value must include double quotes.
- input
Paths {[key: string]: string} - Key value pairs specified in the form of JSONPath (for example, time = $.time)
- You can have as many as 100 key-value pairs.
- You must use JSON dot notation, not bracket notation.
- The keys can't start with "AWS".
- input_
template str - Template to customize data sent to the target. Must be valid JSON. To send a string value, the string value must include double quotes.
- input_
paths Mapping[str, str] - Key value pairs specified in the form of JSONPath (for example, time = $.time)
- You can have as many as 100 key-value pairs.
- You must use JSON dot notation, not bracket notation.
- The keys can't start with "AWS".
- input
Template String - Template to customize data sent to the target. Must be valid JSON. To send a string value, the string value must include double quotes.
- input
Paths Map<String> - Key value pairs specified in the form of JSONPath (for example, time = $.time)
- You can have as many as 100 key-value pairs.
- You must use JSON dot notation, not bracket notation.
- The keys can't start with "AWS".
EventTargetKinesisTarget, EventTargetKinesisTargetArgs
- Partition
Key stringPath - The JSON path to be extracted from the event and used as the partition key.
- Partition
Key stringPath - The JSON path to be extracted from the event and used as the partition key.
- partition
Key StringPath - The JSON path to be extracted from the event and used as the partition key.
- partition
Key stringPath - The JSON path to be extracted from the event and used as the partition key.
- partition_
key_ strpath - The JSON path to be extracted from the event and used as the partition key.
- partition
Key StringPath - The JSON path to be extracted from the event and used as the partition key.
EventTargetRedshiftTarget, EventTargetRedshiftTargetArgs
- Database string
- The name of the database.
- Db
User string - The database user name.
- Secrets
Manager stringArn - The name or ARN of the secret that enables access to the database.
- Sql string
- The SQL statement text to run.
- Statement
Name string - The name of the SQL statement.
- With
Event bool - Indicates whether to send an event back to EventBridge after the SQL statement runs.
- Database string
- The name of the database.
- Db
User string - The database user name.
- Secrets
Manager stringArn - The name or ARN of the secret that enables access to the database.
- Sql string
- The SQL statement text to run.
- Statement
Name string - The name of the SQL statement.
- With
Event bool - Indicates whether to send an event back to EventBridge after the SQL statement runs.
- database String
- The name of the database.
- db
User String - The database user name.
- secrets
Manager StringArn - The name or ARN of the secret that enables access to the database.
- sql String
- The SQL statement text to run.
- statement
Name String - The name of the SQL statement.
- with
Event Boolean - Indicates whether to send an event back to EventBridge after the SQL statement runs.
- database string
- The name of the database.
- db
User string - The database user name.
- secrets
Manager stringArn - The name or ARN of the secret that enables access to the database.
- sql string
- The SQL statement text to run.
- statement
Name string - The name of the SQL statement.
- with
Event boolean - Indicates whether to send an event back to EventBridge after the SQL statement runs.
- database str
- The name of the database.
- db_
user str - The database user name.
- secrets_
manager_ strarn - The name or ARN of the secret that enables access to the database.
- sql str
- The SQL statement text to run.
- statement_
name str - The name of the SQL statement.
- with_
event bool - Indicates whether to send an event back to EventBridge after the SQL statement runs.
- database String
- The name of the database.
- db
User String - The database user name.
- secrets
Manager StringArn - The name or ARN of the secret that enables access to the database.
- sql String
- The SQL statement text to run.
- statement
Name String - The name of the SQL statement.
- with
Event Boolean - Indicates whether to send an event back to EventBridge after the SQL statement runs.
EventTargetRetryPolicy, EventTargetRetryPolicyArgs
- Maximum
Event intAge In Seconds - The age in seconds to continue to make retry attempts.
- Maximum
Retry intAttempts - maximum number of retry attempts to make before the request fails
- Maximum
Event intAge In Seconds - The age in seconds to continue to make retry attempts.
- Maximum
Retry intAttempts - maximum number of retry attempts to make before the request fails
- maximum
Event IntegerAge In Seconds - The age in seconds to continue to make retry attempts.
- maximum
Retry IntegerAttempts - maximum number of retry attempts to make before the request fails
- maximum
Event numberAge In Seconds - The age in seconds to continue to make retry attempts.
- maximum
Retry numberAttempts - maximum number of retry attempts to make before the request fails
- maximum_
event_ intage_ in_ seconds - The age in seconds to continue to make retry attempts.
- maximum_
retry_ intattempts - maximum number of retry attempts to make before the request fails
- maximum
Event NumberAge In Seconds - The age in seconds to continue to make retry attempts.
- maximum
Retry NumberAttempts - maximum number of retry attempts to make before the request fails
EventTargetRunCommandTarget, EventTargetRunCommandTargetArgs
EventTargetSagemakerPipelineTarget, EventTargetSagemakerPipelineTargetArgs
- Pipeline
Parameter List<EventLists Target Sagemaker Pipeline Target Pipeline Parameter List> - List of Parameter names and values for SageMaker Model Building Pipeline execution.
- Pipeline
Parameter []EventLists Target Sagemaker Pipeline Target Pipeline Parameter List - List of Parameter names and values for SageMaker Model Building Pipeline execution.
- pipeline
Parameter List<EventLists Target Sagemaker Pipeline Target Pipeline Parameter List> - List of Parameter names and values for SageMaker Model Building Pipeline execution.
- pipeline
Parameter EventLists Target Sagemaker Pipeline Target Pipeline Parameter List[] - List of Parameter names and values for SageMaker Model Building Pipeline execution.
- pipeline_
parameter_ Sequence[Eventlists Target Sagemaker Pipeline Target Pipeline Parameter List] - List of Parameter names and values for SageMaker Model Building Pipeline execution.
- pipeline
Parameter List<Property Map>Lists - List of Parameter names and values for SageMaker Model Building Pipeline execution.
EventTargetSagemakerPipelineTargetPipelineParameterList, EventTargetSagemakerPipelineTargetPipelineParameterListArgs
EventTargetSqsTarget, EventTargetSqsTargetArgs
- Message
Group stringId - The FIFO message group ID to use as the target.
- Message
Group stringId - The FIFO message group ID to use as the target.
- message
Group StringId - The FIFO message group ID to use as the target.
- message
Group stringId - The FIFO message group ID to use as the target.
- message_
group_ strid - The FIFO message group ID to use as the target.
- message
Group StringId - The FIFO message group ID to use as the target.
Import
Using pulumi import
, import EventBridge Targets using event_bus_name/rule-name/target-id
(if you omit event_bus_name
, the default
event bus will be used). For example:
$ pulumi import aws:cloudwatch/eventTarget:EventTarget test-event-target rule-name/target-id
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.