Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Here's how:
var aws = require("awsm")(require("./awsConfig")).chain();
// let's go ahead and provision a few ubuntu instances around the globe.
aws.regions().all().createInstance({ type: "m3.medium", imageId: "ami-a73264ce" }).start().then(function (err, instances) {
console.log(instances);
});
How about migrating a pre-existing image? Easy:
aws.regions().all(function (err, regions) {
aws.images().find({ "tags.type": "my-awesome-application" }).migrate(regions).then(function (err, images) {
// should be roughly ~ 7 images that have been migrated to every
// AWS region.
console.log(images);
});
});
Awsm is also extendable. Want to add SSH? No problem:
var aws = require("awsm")(require("./awsConfig"));
aws.use(require("awsm-ssh");
var awsc = aws.chain();
awsc.
instances().
// find all servers in the staging environment
find({ "tags.env": "staging", "tags.type": "my-mega-awesome-application" }).
// let's copy some local files to all mega awesome applications.
rsync("~/Developer/applications/my-mega-awesome-application", "/remote/app/directory").
parallel().
// let's start this sucker.
exec("node /remote/app/directory").
// after the process closes - this will never happen since exec (above) won't close. Have
// you taken a look at node-awsm-cli?
then(function (err, instances) {
// donezo.
});
Want a command line interface? This is not the repository you're looking for. Checkout awsm-cli.
Initializes the awsm library.
key
- aws keysecret
- aws secretec2
- the ec2 config
regions
(array) - regions to use (["us-east-1", "us-west-1", ...])log
- log config
level
- the log level to use - notice
, verbose
, warn
, error
Resource collections share a common API, and are used for every object type which includes regions
, instances
, images
, securityGroups
, and keyPairs
.
Finds many resources in the target collection.
// find all U.S. regions
awsm.ec2.regions.find({ name: /^us/ }, onUsRegions);
// find all running instances in a given region
region.instances.find({ state: "running" }, onAllRunningInstances);
Finds one resource against a target collection.
// find an image with the given name
region.images.findOne({ name: "some-image-name" }, onImage);
Below are a list of available collections to search against
awsm.ec2.instances
- all
instances across all
regions.awsm.ec2.images
- all
images across all regions
.awsm.ec2.regions
- all
regions.region.instances
- instances specific to the region.region.images
- images specific to the region.Awsm allows you to interface against multiple EC2 regions pretty easily - all you need to do is pass which regions you want to use in the main config.
var aws = awsm({
key: "KEY",
secret: "SECRET"
ec2: {
regions: ["us-east-1", "us-west-2"]
}
})
Note that the regions
property is completely optional - awsm will automatically default to all
EC2 regions if the property is omitted.
Here are a few examples of how you might interact with awsm regions:
// init awsm
var awsm = awsm({ key: "key", secret: "secret" });
// get all regions
awsm.ec2.regions.all(onAllRegions);
// find all U.S. regions
awsm.ec2.regions.find({ name: /^us/ }, onAllUSRegions);
// find ALL instances in ALL regions
awsm.ec2.instances.all(onAllInstancesFromAllRegions);
// find ALL RUNNING instances in ALL regions
awsm.ec2.instances.find({ state: "running" }, onAllRunningInstances);
Allows you to tag specific instances, images, security groups, or key pairs.
Updates the tags on the specific resource
instance.tags.update({ type: "mongodb" }, function () {
console.log(instance.get("tags")); // { type: mongodb }
})
Creates a new instance in the target region.
imageId
- (required) imageId to usecount
- (default = 1) number of instances to createflavor
- (default = t1.micro) type of instance to use (t1.micro, m1.medium)securityGroup
- (optional) the security group object to use with the instancekeyPair
- (optional) the key pair object to use with the instanceregion.instances.create({ imageId: "ami-a73264ce" }, function (err, instance) {
console.log(instance.get("state")); // running
console.log(instance.get("_id")); // instance id
})
starts the instance
restarts the instance
stops the instance
creates an image out of the instance
returns all the volumes attached to the instance
returns all the securityGroups attached to the instance
returns the allocated address assigned to the specific instance
returns the image used to create the instance
returns the keypair assigned to the instance
instance tags collection
destroys the instance
creates a new image
creates a new instance from the image
migrates the image to another region
destroys the image
allocates a new address
associates an address with an instance
detaches from an instance
returns the instance associated with the address
address tags collection
releases the address
creates a new volume
attaches to an instance
detaches from an instance
returns all the instances this volume is attached to
creates a new snapshot of the volume
destroys the volume
creates a snapshot
creates a volume out of the snapshot
returns the snapshot associated with the given volume
destroys the snapshot
creates a new keypair
destroys the keypair
creates a security group
authorizes a port in the security group
revokes port
destroys the security group.
TODO - Checkout the examples at the top.
FAQs
node-awsm =========
We found that awsm demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.