Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///// la fonction lambda pour describeVolumes dans EC2 en nodejs
- var AWS = require('aws-sdk');
- AWS.config.update({region: 'us-east-2'});
- exports.handler= function(event, context) {
- // Create EC2 service object
- var ec2 = new AWS.EC2({apiVersion: '2016-11-15'});
- const params = {};
- // Call EC2 to retrieve policy for selected bucket
- ec2.describeVolumes(params, function(err, data) {
- if (err) {
- console.log("Error", err.stack);
- } else {
- const id = data.Volumes[0].State;
- const state = data.Volumes[0].Size;
- console.log("Success", id , state);
- }
- });
- };
- ///// Résultat de la fonction :
- START RequestId: 065a85bb-02cf-4cf2-bb36-8ce0f15de5b0 Version: $LATEST
- 2019-12-11T08:58:07.690Z 065a85bb-02cf-4cf2-bb36-8ce0f15de5b0
- INFO Success available 2
- END
- RequestId: 065a85bb-02cf-4cf2-bb36-8ce0f15de5b0
- REPORT RequestId: 065a85bb-02cf-4cf2-bb36-8ce0f15de5b0 Duration: 1659.26 ms Billed Duration: 1700 ms Memory Size: 128 MB Max Memory Used: 98 MB Init Duration: 301.62 ms
- ////// Question :
- j'ai le bon résultat mais j'ai adapté le code pris sur le sdk lambda nodejs problème comme je suis novice je ne comprend pas bien la structure avec l'index[0]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement