‫So here is a quick lecture
‫on how to integrate X-Ray with Beanstalk.
‫So the Beanstalk platforms include the X-Ray daemon,
‫so we don't need to include it
‫and you can run the daemon
‫by just setting one option in the Beanstalk console,
‫as we'll see in the hands-on
‫or you can create as well an EB extensions file
‫called xray-daemon.config,
‫so again, in .ebextensions folder
‫with a '.config' extension that looks like this
‫and it's just one line,
‫it just enables the X-Ray daemon, so simple.
‫Then once you do this, obviously you need to make sure
‫that your EC2 instance has an instance profile
‫with a correct IAM permission
‫so that the X-Ray daemon
‫can function correctly and right to the X-Ray service
‫and of course you need to make sure
‫that your application code is instrumented
‫with the extra SDK to send these traces
‫and if you do run multi-docker container,
‫you would need to manage the X-Ray demon yourself
‫as we'll see in the next lecture with ECS.
‫Okay, so just go to the Amazon Elastic Beanstalk console
‫and then create an application.
‫So this one is called demo X-Ray,
‫and I just wanna show you
‫which options are important to get X-Ray set up.
‫So for the platform,
‫just choose Node.js and then the recommended settings.
‫We'll use the sample application
‫and we'll click on configure more options.
‫So when we configure more options,
‫the important part is going to be around software.
‫So you click on software and edit
‫and as you can see, it just takes one click
‫to enable the X-Ray daemon to be running
‫on your Beanstalk environment,
‫so that's the first step of what you need to do.
‫So you do this and then you do save
‫and the second part is to make sure
‫that the EC2 instances have an IAM role
‫that allow them to connect into X-Ray.
‫So to do so, we'll go into security and edit this
‫and as you can see,
‫we need to have a virtual mission permission
‫called an IAM Instance profile and choose from this list.
‫So right now for me what's selected
‫is the AWS Elastic Beanstalk EC2 role.
‫So let's go into IAM just to have a look
‫at what this role is about.
‫So under roles, let's type Beanstalk
‫and we have the Elastic Beanstalk EC2 role
‫and if we have a look at the permissions right now,
‫I have three permission policies,
‫the Beanstalk web tier, multi container docker
‫and worker tier.
‫If I click on the first one
‫which is the Beanstalk web tier,
‫I can have a look at a policy summary
‫and underneath we see that we have permissions
‫for X-Ray in here and if I click on them,
‫we have read permissions to get the sampling rules,
‫statistics summaries and targets for the sampling
‫and then for right,
‫we have put elementary record and put trace segments
‫which allows us to send data into X-Ray.
‫So if you were to assign another EC2 instance role or IAM
‫since profile to your EC2 instance, please make sure
‫you still have the necessary extra permissions.
‫So that's, even though you have enabled
‫the daemon on Beanstalk,
‫you still need to also make sure the IAM role is correct.
‫So that's it for this lecture.
‫Just make sure when you're done to take this application
‫and take it down
‫but now you know how to make beanstalk work with X-Ray.
‫So I hope you liked it
‫and I will see you in the next lecture.