-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
41 lines (38 loc) · 1.13 KB
/
index.js
File metadata and controls
41 lines (38 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
exports.handler = (event, context, callback) => {
var AWS = require('aws-sdk');
AWS.config.update({ region: 'us-east-1' });
var cloudformation = new AWS.CloudFormation({region: 'us-east-1'});
var s3 = new AWS.S3({params: {Bucket: 'serverless-pipeline-artifacts'}, region: 'us-east-1'});
var params = {
StackName: 'sample-node-stack',
DisableRollback: false,
ResourceTypes: [
'AWS::*'
],
Tags: [
{
Key: 'Name', /* required */
Value: 'sample-node' /* required */
}
],
TemplateURL: 'https://s3.amazonaws.com/serverless-pipeline-artifacts/templates/sample-node/resource.json',
TimeoutInMinutes: 5
};
cloudformation.createStack(params, function(err, data) {
if (err) {
console.log(err, err.stack); // an error occurred
} else {
console.log(data); // successful response
//Uploading Sample file to S3
s3.putObject({
Bucket: 'serverless-pipeline-artifacts',
Key: 'test/sample-node.txt',
Body: 'Invoke Test'
}, function(err, data) {
console.log("Error ==== " + err);
console.log("Data ==== " + data);
});
}
});
callback(null, "SUCCESS");
};