Question

How do I limit an app to just be deployed to one layer per default in AWS Opsworks?

I have set up a webhook from Github to automatically deploy my app to Opsworks but the app is deployed to all my layers when it should only be deployed to one layer.

Was it helpful?

Solution

I struggled for a bit with the same question and I think I finally got an answer:

  1. Create a new SNS topic.

  2. Create an AWS Lambda function that launches the deploy for you on whatever you want using the JavaScript AWS-SDK. So you can get the idea:

var AWS = require('aws-sdk');
AWS.config.region = 'us-east-1'; // Opsworks only uses this one for Stacks in any region
var opsworks = new AWS.OpsWorks();
opsworks.describeStacks({}, function(err, data) {
  console.log(data);
  context.succeed(message);
});

  1. Assign the required policies to this lambda function to allow whatever you call from the AWS API.

  2. Set Github to send the notification to the SNS topic rather than calling Opsworks directly.

OTHER TIPS

If possible, please provide the screenshot showing how your layers and instances are setup. I think it may be a misconfiguration that is causing the layers to install the application.

By default Opsworks wont install applications on all the layers unless it's specified in the set of layers to run the related recipe for that instance.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top