Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
cdk-spot-one
Advanced tools
One spot instance with EIP and defined duration. No interruption.
Sometimes we need an Amazon EC2 instance with static fixed IP for testing or development purpose for a duration of
time(probably hours). We need to make sure during this time, no interruption will occur and we don't want to pay
for on-demand rate. cdk-spot-one
helps you reserve one single spot instance with pre-allocated or new
Elastic IP addresses(EIP) with defined blockDuration
, during which time the spot instance will be secured with no spot interruption.
Behind the scene, cdk-spot-one
provisions a spot fleet with capacity of single instance for you and it associates the EIP with this instance. The spot fleet is reserved as spot block with blockDuration
from one hour up to six hours to ensure the high availability for your spot instance.
Multiple spot instances are possible by simply specifying the targetCapacity
construct property, but we only associate the EIP with the first spot instance at this moment.
Enjoy your highly durable one spot instance with AWS CDK!
import { SpotFleet } from 'cdk-spot-one';
// create the first fleet for one hour and associate with our existing EIP
const fleet = new SpotFleet(stack, 'SpotFleet')
// configure the expiration after 1 hour
fleet.expireAfter(Duration.hours(1))
// create the 2nd fleet for 6 hours and associate with new EIP
const fleet2 = new SpotFleet(stack, 'SpotFleet2', {
blockDuration: BlockDuration.SIX_HOURS,
eipAllocationId: 'eipalloc-0d1bc6d85895a5410',
vpc: fleet.vpc,
})
// configure the expiration after 6 hours
fleet2.expireAfter(Duration.hours(6))
// print the instanceId from each spot fleet
new CfnOutput(stack, 'SpotFleetInstanceId', { value: fleet.instanceId })
new CfnOutput(stack, 'SpotFleet2InstanceId', { value: fleet2.instanceId })
By default the cdk-spot-one
does not assign any SSH public key for you on the instance. You are encouraged to use ec2-instance-connect
to send your public key from local followed by one-time SSH connect.
For example:
pubkey="$HOME/.ssh/aws_2020_id_rsa.pub"
echo "sending public key to ${instanceId}"
aws ec2-instance-connect send-ssh-public-key --instance-id ${instanceId} --instance-os-user ec2-user \
--ssh-public-key file://${pubkey} --availability-zone ${az}
You may also create a simple ec2-connect.sh
script like this and save in your $PATH:
#!/bin/bash
instanceId=$1
pubkey="$HOME/.ssh/aws_2020_id_rsa.pub"
sshUser='ec2-user'
az=$(aws ec2 describe-instances --instance-id ${instanceId} --query 'Reservations[0].Instances[0].Placement.AvailabilityZone' --output text)
publicIp=$(aws ec2 describe-instances --instance-id ${instanceId} --query 'Reservations[0].Instances[0].PublicIpAddress' --output text)
echo "sending public key to ${instanceId}"
aws ec2-instance-connect send-ssh-public-key --instance-id ${instanceId} --instance-os-user ${sshUser} \
--ssh-public-key file://${pubkey} --availability-zone ${az} > /dev/null
if [[ $2 != '--send-key-only' ]]; then
echo "connecting to ${publicIp} at ${az}"
ssh ${sshUser}@${publicIp}
fi
And simply run this to connect to the EC2 instance.
$ ec2-connect.sh i-01f827ab9de7b93a9
It's also possible to explicitly specify your existing SSH key with the keyName
construct property if you like.
FAQs
One spot instance with EIP and defined duration. No interruption.
The npm package cdk-spot-one receives a total of 39 weekly downloads. As such, cdk-spot-one popularity was classified as not popular.
We found that cdk-spot-one 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.