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.60.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3233996248c3349d3d17f81248a172b8f0ccd4f38603c81af966ac74a592e6d9 |
|
MD5 | d83fee926030b8a6ae4547db0fae0044 |
|
BLAKE2b-256 | 114a7da03afed574c87235d64c2d252b1e1b07860e81a0f5f7954c9427c2e452 |
Close
Hashes for cdk_fargate_run_task-0.0.60-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 072c0c94afa0b11d9f7f791baab1ecae4108d589789935ba98665810cc466569 |
|
MD5 | c5a854b706ff1fb9e4ba4d1b4d0f0c54 |
|
BLAKE2b-256 | 2150197c8a6ddf692937c4a752bedc07e59ee834f49470a0510fbaf64cbe18cf |