I’m trying to create an EC2 instance from a server method. I’m using https://atmospherejs.com/eluck/aws-sdk.
I have a server method that has this as its contents [Example AWS NodeJS SDK EC2 Deploy]:
AWS.config.region = 'eu-west-1';
var ec2 = new AWS.EC2();
var params = {
ImageId: 'ami-1624987f', // Amazon Linux AMI x86_64 EBS
InstanceType: 't1.micro',
MinCount: 1, MaxCount: 1
};
// Create the instance
ec2.runInstances(params, function(err, data) {
if (err) { console.warn("Could not create instance", err); return; }
var instanceId = data.Instances[0].InstanceId;
console.warn("Created instance", instanceId);
// Add tags to the instance
params = {Resources: [instanceId], Tags: [
{Key: 'Name', Value: instanceName}
]};
ec2.createTags(params, function(err) {
console.warn("Tagging instance", err ? "failure" : "success");
});
});
I also have environment settings:
if (Meteor.settings.AWS) {
AWS.config.update({
AWS_ACCESS_KEY_ID: Meteor.settings.AWS.accessKeyId,
AWS_SECRET_ACCESS_KEY: Meteor.settings.AWS.secretAccessKey
});
console.warn("AWS working");
} else {
console.warn("AWS settings missing");
}
Nothing actually deploys, does anyone have any experience or idea why that this might happening?