1 00:00:00,000 --> 00:00:01,380 ‫So here is a quick lecture 2 00:00:01,380 --> 00:00:04,590 ‫on how to integrate X-Ray with Beanstalk. 3 00:00:04,590 --> 00:00:07,560 ‫So the Beanstalk platforms include the X-Ray daemon, 4 00:00:07,560 --> 00:00:09,720 ‫so we don't need to include it 5 00:00:09,720 --> 00:00:10,620 ‫and you can run the daemon 6 00:00:10,620 --> 00:00:13,170 ‫by just setting one option in the Beanstalk console, 7 00:00:13,170 --> 00:00:14,520 ‫as we'll see in the hands-on 8 00:00:14,520 --> 00:00:17,340 ‫or you can create as well an EB extensions file 9 00:00:17,340 --> 00:00:19,770 ‫called xray-daemon.config, 10 00:00:19,770 --> 00:00:22,410 ‫so again, in .ebextensions folder 11 00:00:22,410 --> 00:00:25,500 ‫with a '.config' extension that looks like this 12 00:00:25,500 --> 00:00:26,670 ‫and it's just one line, 13 00:00:26,670 --> 00:00:29,940 ‫it just enables the X-Ray daemon, so simple. 14 00:00:29,940 --> 00:00:32,010 ‫Then once you do this, obviously you need to make sure 15 00:00:32,010 --> 00:00:34,500 ‫that your EC2 instance has an instance profile 16 00:00:34,500 --> 00:00:35,820 ‫with a correct IAM permission 17 00:00:35,820 --> 00:00:36,750 ‫so that the X-Ray daemon 18 00:00:36,750 --> 00:00:40,410 ‫can function correctly and right to the X-Ray service 19 00:00:40,410 --> 00:00:41,580 ‫and of course you need to make sure 20 00:00:41,580 --> 00:00:44,070 ‫that your application code is instrumented 21 00:00:44,070 --> 00:00:46,950 ‫with the extra SDK to send these traces 22 00:00:46,950 --> 00:00:49,350 ‫and if you do run multi-docker container, 23 00:00:49,350 --> 00:00:51,540 ‫you would need to manage the X-Ray demon yourself 24 00:00:51,540 --> 00:00:54,060 ‫as we'll see in the next lecture with ECS. 25 00:00:54,060 --> 00:00:57,660 ‫Okay, so just go to the Amazon Elastic Beanstalk console 26 00:00:57,660 --> 00:00:59,640 ‫and then create an application. 27 00:00:59,640 --> 00:01:01,920 ‫So this one is called demo X-Ray, 28 00:01:01,920 --> 00:01:02,753 ‫and I just wanna show you 29 00:01:02,753 --> 00:01:05,850 ‫which options are important to get X-Ray set up. 30 00:01:05,850 --> 00:01:06,683 ‫So for the platform, 31 00:01:06,683 --> 00:01:10,470 ‫just choose Node.js and then the recommended settings. 32 00:01:10,470 --> 00:01:11,880 ‫We'll use the sample application 33 00:01:11,880 --> 00:01:14,463 ‫and we'll click on configure more options. 34 00:01:16,320 --> 00:01:17,700 ‫So when we configure more options, 35 00:01:17,700 --> 00:01:20,340 ‫the important part is going to be around software. 36 00:01:20,340 --> 00:01:21,990 ‫So you click on software and edit 37 00:01:21,990 --> 00:01:24,270 ‫and as you can see, it just takes one click 38 00:01:24,270 --> 00:01:26,760 ‫to enable the X-Ray daemon to be running 39 00:01:26,760 --> 00:01:28,020 ‫on your Beanstalk environment, 40 00:01:28,020 --> 00:01:30,360 ‫so that's the first step of what you need to do. 41 00:01:30,360 --> 00:01:32,702 ‫So you do this and then you do save 42 00:01:32,702 --> 00:01:34,680 ‫and the second part is to make sure 43 00:01:34,680 --> 00:01:37,260 ‫that the EC2 instances have an IAM role 44 00:01:37,260 --> 00:01:41,070 ‫that allow them to connect into X-Ray. 45 00:01:41,070 --> 00:01:45,180 ‫So to do so, we'll go into security and edit this 46 00:01:45,180 --> 00:01:46,013 ‫and as you can see, 47 00:01:46,013 --> 00:01:47,970 ‫we need to have a virtual mission permission 48 00:01:47,970 --> 00:01:51,840 ‫called an IAM Instance profile and choose from this list. 49 00:01:51,840 --> 00:01:53,340 ‫So right now for me what's selected 50 00:01:53,340 --> 00:01:56,520 ‫is the AWS Elastic Beanstalk EC2 role. 51 00:01:56,520 --> 00:01:58,920 ‫So let's go into IAM just to have a look 52 00:01:58,920 --> 00:02:00,513 ‫at what this role is about. 53 00:02:01,800 --> 00:02:04,980 ‫So under roles, let's type Beanstalk 54 00:02:04,980 --> 00:02:08,460 ‫and we have the Elastic Beanstalk EC2 role 55 00:02:08,460 --> 00:02:10,290 ‫and if we have a look at the permissions right now, 56 00:02:10,290 --> 00:02:11,850 ‫I have three permission policies, 57 00:02:11,850 --> 00:02:15,210 ‫the Beanstalk web tier, multi container docker 58 00:02:15,210 --> 00:02:16,380 ‫and worker tier. 59 00:02:16,380 --> 00:02:18,000 ‫If I click on the first one 60 00:02:18,000 --> 00:02:20,760 ‫which is the Beanstalk web tier, 61 00:02:20,760 --> 00:02:23,005 ‫I can have a look at a policy summary 62 00:02:23,005 --> 00:02:25,710 ‫and underneath we see that we have permissions 63 00:02:25,710 --> 00:02:28,470 ‫for X-Ray in here and if I click on them, 64 00:02:28,470 --> 00:02:32,010 ‫we have read permissions to get the sampling rules, 65 00:02:32,010 --> 00:02:34,620 ‫statistics summaries and targets for the sampling 66 00:02:34,620 --> 00:02:35,640 ‫and then for right, 67 00:02:35,640 --> 00:02:39,510 ‫we have put elementary record and put trace segments 68 00:02:39,510 --> 00:02:42,120 ‫which allows us to send data into X-Ray. 69 00:02:42,120 --> 00:02:46,650 ‫So if you were to assign another EC2 instance role or IAM 70 00:02:46,650 --> 00:02:49,200 ‫since profile to your EC2 instance, please make sure 71 00:02:49,200 --> 00:02:52,080 ‫you still have the necessary extra permissions. 72 00:02:52,080 --> 00:02:53,970 ‫So that's, even though you have enabled 73 00:02:53,970 --> 00:02:54,930 ‫the daemon on Beanstalk, 74 00:02:54,930 --> 00:02:58,110 ‫you still need to also make sure the IAM role is correct. 75 00:02:58,110 --> 00:02:59,580 ‫So that's it for this lecture. 76 00:02:59,580 --> 00:03:02,670 ‫Just make sure when you're done to take this application 77 00:03:02,670 --> 00:03:03,750 ‫and take it down 78 00:03:03,750 --> 00:03:07,650 ‫but now you know how to make beanstalk work with X-Ray. 79 00:03:07,650 --> 00:03:09,000 ‫So I hope you liked it 80 00:03:09,000 --> 00:03:10,950 ‫and I will see you in the next lecture.