Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
fargate-helper
Advanced tools
This tool creates or updates a Fargate service, along with the pieces that it relies on (ELB Rules, Target Group, Health Check, etc.).
It assumes that an image has been pushed to Docker Hub - it takes the image name and creates a Fargate service around it.
The tool supports the following actions:
The syntax for the script is:
fargate <action> <options>
Example (creates or updates the service my-service
with the specified parameters):
fargate service \
--command "node lib/service.js" \
--containerPort 3000 \
--cpu 1024 \
--env key=value \
--image bespoken/my-service-image \
--memory 2048 \
--name my-service
For create
, the script will:
For update
, the script will:
For delete
, the script will:
For service
, the script will:
For schedule
, the script will:
For ec2-instance
, the script will:
More information here:
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/scheduled_tasks_cli_tutorial.html
Install the package:
npm install fargate-helper -g
Set these environment variables - for the AWS SDK that this relies on:
us-east-1
if not setThe parameters for configuring the service come from three places:
These parameters must be manually configured for the deployment to run:
Though not required, these are useful parameters for more advanced cases:
fargate-cluster
By changing the launchType
parameter to 'EC2' we can leverage all the current functionality and deploy to EC2, provided that the EC2 instances already exist on the target ECS cluster. We can create EC2 instances by using the ec2-instance
.
Also important, if launchType
is 'EC2' the cpu and memory parameters will correspond to the cpu
and memoryReservation
of the service's container definition. For 'FARGATE' they correspond to the task level cpu
and memory
properties.
Finally, for EC2 we'll be using the bridge
network mode. This means:
instance
instead of ip
healthCheckPort
to traffic-port
For the command-line, parameters are passed in with the format:
--name value
For parameters with spaces, they should be passed in as so:
--name "my value"
NOTE The memory and CPU must be valid for Fargate. The supported configurations are here:
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-cpu-memory-error.html
Parameters can also be set via environment variable. If the parameter is not specified on the command-line, but is found in the environment, that will be used.
For example:
export cpu=1024
fargate create --name serviceName
In this case, the cpu
will be set to 1024
for the service.
We store certain key default parameters, such as DockerHub credentials, in defaults in the AWS Secret Manager.
These are values that are generally universal for the account - these should not need to changed or overridden.
They can be found under the name "fargate-helper". Values we store there are:
For ec2, the following values were added:
Environment variables can also be set inside the running container.
If --passEnv
is set to true, we take all the environment variables currently set and pass them to the container in the taskDefinition, under environment.
Environment variables in the container can also be set by specifying on the command-line:
fargate create --env KEY=VALUE
This will set the environment variable key
to value
inside the container.
Additionally, the --envFile
parameter can be used - this takes as an argument a relative path to a file in key value form. All values in this file will be set in the container (via the Environment section on the TaskDefinition).
By default, we create a target group with rules on our ELB when first creating the service.
The target group will be configured:
<SERVICE_NAME>.bespoken.io
to the serviceFor more complex ELB configurations, we recommend they be done manually, and then only update be called (which does not modify the ELB configuration).
fargate delete --name my-service
fargate schedule \
--command "node lib/service.js" \
--cpu 1024 \
--env key=value \
--image bespoken/my-service-image \
--memory 2048 \
--cron "cron(0 12 * * ? *)" \
--name my-scheduled-task
fargate ec2-instance \
--cluster fargate-helper \
--IAMInstanceProfile ecsInstanceRole \
--imageId ami-09edd32d9b0990d49 \
--instanceType t3.micro \
--keyPair ecs-ec2-cluster \
To see a sample project that uses this, check out the Utterance Tester:
https://github.com/bespoken/UtteranceTester
In particular, here is the Circle CI configuration:
https://github.com/bespoken/UtteranceTester/blob/master/.circleci/config.yml#L32
FAQs
Helper scripts for deploying to Fargate
The npm package fargate-helper receives a total of 4 weekly downloads. As such, fargate-helper popularity was classified as not popular.
We found that fargate-helper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.