Define and run container tasks on AWS Fargate immediately or with schedule
Project description
cdk-fargate-run-task
Define and run container tasks on AWS Fargate at once or by schedule.
sample
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
app = cdk.App()
env = {
"account": process.env.CDK_DEFAULT_ACCOUNT,
"region": process.env.CDK_DEFAULT_REGION
}
stack = cdk.Stack(app, "run-task-demo-stack", env=env)
# define your task
task = ecs.FargateTaskDefinition(stack, "Task", cpu=256, memory_limit_mi_b=512)
# add contianer into the task
task.add_container("Ping",
image=ecs.ContainerImage.from_registry("busybox"),
command=["sh", "-c", "ping -c 3 google.com"
],
logging=ecs.AwsLogDriver(
stream_prefix="Ping",
log_group=LogGroup(stack, "LogGroup",
log_group_name=f"{stack.stackName}LogGroup",
retention=RetentionDays.ONE_DAY
)
)
)
# deploy and run this task once
run_task_at_once = RunTask(stack, "RunDemoTaskOnce", task=task)
# or run it with schedule(every hour 0min)
RunTask(stack, "RunDemoTaskEveryHour",
task=task,
cluster=run_task_at_once.cluster,
run_once=False,
schedule=Schedule.cron(minute="0")
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for cdk-fargate-run-task-0.0.34.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93cc214d778ae46e23719f31a551531a42563adc3ae7eb7ee676d12553fb4ee4 |
|
MD5 | f9f372f83ea5e719627f2ae9123f0742 |
|
BLAKE2b-256 | a8465bc3c594f4885fe885c17f2cb84f3a4bdc343f34e35cb3a3c51865f7f1fb |
Close
Hashes for cdk_fargate_run_task-0.0.34-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8043c536cb09e843a527f26180f69651e35d12dec6dac9b4d8c584665de6c007 |
|
MD5 | 2dae5eb31e0da6b4d0ccb3539b3e466a |
|
BLAKE2b-256 | ef744f7c72f7b1a1ffe874f8cc0840716c59e87d8b75350b1c01ddfbeded47ec |