Can we block routes/traffic using the AS number/AS path?
The AS is the router in the internet and there is no direct/indirect BGP peering with the device/AS.
No, we cannot configure any criteria if there is no Direct/Indirect BGP peering. A BGP peering is necessary for this.
If a direct/indirect BGP peering is present, we can configure the BGP to reject the routes as below:
set policy-options policy-statement reject-some-routes term find-routes from as-path orig-in-64513 set policy-options policy-statement reject-some-routes term find-routes from as-path orig-in-64514 set policy-options policy-statement reject-some-routes term find-routes then reject
Reference - https://www.juniper.net/documentation/us/en/software/junos/routing-policy/topics/example/policy-as-path-regular-expressions.html