Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the SDK V3 Style #794

Merged
merged 3 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions barcelona.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ environments:
name: barcelona
image_name: public.ecr.aws/degica/barcelona
before_deploy: rake db:migrate
scheduled_tasks:
# 10AM JST every week day
- schedule: cron(0 1 ? * MON-FRI *)
command: bin/chaos
scheduled_tasks: []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are removing all scheduled task now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, sorry let me remove that

services:
- name: web
service_type: web
Expand All @@ -45,3 +42,4 @@ environments:
command: rake jobs:work
cpu: 128
memory: 256

26 changes: 14 additions & 12 deletions schedule_handler.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
var AWS = require('aws-sdk');
const { ECSClient, RunTaskCommand } = require("@aws-sdk/client-ecs");

var util = require('util');

exports.handler = function(input, context) {
console.log(util.inspect(input, {showHidden: false, depth: null}))
console.log(context)
exports.handler = async function(input, context) {
console.log(util.inspect(input, {showHidden: false, depth: null}));
console.log(context);

var ecs = new AWS.ECS();
var ecs = new ECSClient();
var params = {
cluster: input.cluster,
taskDefinition: input.task_family,
Expand All @@ -17,11 +18,12 @@ exports.handler = function(input, context) {
}
]
}
}
};

console.log(util.inspect(params, {depth: null}));

const command = new RunTaskCommand(params);
const response = await ecs.send(command);

console.log(util.inspect(params, {depth: null}))
ecs.runTask(params, function(err, data) {
console.log(util.inspect(err, {depth: null}))
console.log(util.inspect(data, {depth: null}))
})
}
console.log(util.inspect(response, {depth: null}));
};
Loading