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.12.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e475750291bf1d134e4003dd11fa56e22cb4a961538369898cda8312970eb0bf |
|
MD5 | 8cd337f4fc9d4ba431a0bd5d58000e45 |
|
BLAKE2b-256 | a8f94f203f431d6a5f3356629afc348bb8f166792a61a15e04686a8f4eeeba59 |
Close
Hashes for cdk_fargate_run_task-0.0.12-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1e5dd3dce8769e9ec59be94b2ffc506cac98fb518263f31a8c96aa97f7dbe66 |
|
MD5 | 3855e8fd176d11c961d6e2c8f3810d19 |
|
BLAKE2b-256 | bbbc4a8d96c26f32092a8aa0b9cf182bb5850bd6bf2f2ba5072819c48178c6c8 |