You need to use this interface: force:hasRecordId
<aura:component implements="force:lightningQuickAction,force:hasRecordId,force:appHostable,flexipage:availableForRecordHome,force:hasRecordId,force:hasSObjectName" access="global" >
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<b>This is recordID {!v.recordId} </b><br/>
</aura:componet>
javascript:
doInit:function(componet,event,helper){
component.get("v.recordId");
}
Notes:
If your component implements force:hasRecordId interface, you don’tno need to add a recordId attribute to the component yourself.
The component’s controller can access the ID of the current record from the recordId attribute, using component.get("v.recordId"). The recordId attribute is automatically added to the component by the force:hasRecordId interface.
Read this Link for more Information:
https://developer.salesforce.com/docs/component-library/bundle/force:hasRecordId/documentation